3

I'm very new to Web server matters, and relatively a naive student of C++. I'm now working on a project where I have to create a Plugin to an existing web server. It is a commercial project for a company, but it's also my bachelor thesis project. I'm not quite sure which web server would be suitable for my project. The web server that I am looking for should handle the Network socket and present the http or https request as object,from which the plugin(That I want to develop) should read the header,url,data and translate(translating specially the SOAP and REST) it accordingly for the company's Data storage's Filesystem API and vice versa.The plugin has to be developed using C++.The server environment is Linux Cent OS 6. The normal staffs of the company has never worked with linux server environment before. Its a small company. They only worked with windows and IIS web server before. Our project manager is reluctant to use Apache because it has heavy footprint and it's slow, while IIS is not suitable for linux. So, we are looking for a free light-weight web server for linux.

I see that people talk a lot about Nginx, G-WAN, Cherokee, Lightspeed, Varnish, Tntnet etc. But I didn't really find any standarad source of judgement about the comparison of these web servers. So, please let me know, which web server would be preferable for me. Waiting for response.

the_naive
  • 2,936
  • 6
  • 39
  • 68
  • 1
    With all those requirments, this will be anything but "small" and "simple", no matter what way you bend it. As you additionally need it to be cross platform, there's hardly any alternatives but apache+apr+ a portable soap library. – nos Mar 20 '12 at 14:18
  • Too big means it has a heavy foot print. I want a web server with small footprint. Apache has a lot of functionality which tends to make it slow, and it has heavy footprint. The webserver I need just need to have basic authentication, with the ability to handle http and https and present it like an object. I hope it clarifies. Kindly ask more questions if you have confusion about what I mean. – the_naive Mar 20 '12 at 14:43
  • Do you need to write a plugin for a full grown webserver? Alternatively you may use CGI or FastCGI which will allow you to support any webserver supporting these standards so you are not limited to a specific one. – Alex Mar 20 '12 at 15:32
  • Functionalities are not enough. What kind of reliability and performance under heavy load do you need? To get them, you need a complex HTTP server. See also my answer suggesting libraries to make your application a standalone HTTP server. – Basile Starynkevitch Mar 20 '12 at 18:49

3 Answers3

2

"I didn't really find any standarad source of judgement about the comparison of these web servers."

An academic has done such a comparison of most of the servers that you have cited. Tntnet is tested elsewhere.

"please let me know, which web server would be preferable for me."

Given the constraints that you have expressed:

"the company has never worked with linux server environment before. Its a small company. They only worked with windows and IIS web server before. Our project manager is reluctant to use Apache because it has heavy footprint and it's slow, while IIS is not suitable for linux. So, we are looking for a free light-weight web server for linux"

G-WAN (150 KB) is the most lightweight, and its C/C++ scripts will save you the trouble of having to recompile and link the modules that other servers need.

G-WAN was initially written on Windows by people who never ventured on Linux (before making a Linux port, which came 6 months after the Windows release).

As a result, G-WAN was designed to be as simple as possible (optimal settings are applied without configuration files or system scripts) because that was making life easier for the developers.

But don't take my word for it (I am part of the G-WAN team) and give it a try - that's the only way to see if it matches your needs.

Gil
  • 3,279
  • 1
  • 15
  • 25
2

There are several, for example lighttpd. Here is a description of how C plugins can be built for it.

NOTE

I want the source code of web server to be as less as possible.

The length of the source code is not a good metric for performance and memory use of a program.

Constantinius
  • 34,183
  • 8
  • 77
  • 85
  • What about the stability of Lighttpd? Is it stable? – the_naive Mar 20 '12 at 14:44
  • And, moreover I'd like to understand the source code of lighttpd. Could you say me how I should proceed? – the_naive Mar 20 '12 at 14:47
  • Lighttpd is stable as it is in use for about 9 years. You can retrieve the source code under http://www.lighttpd.net/download. Lighttpd is written in C, so you have to be proficient with that language in order to understand the source code. I'm sure there is documentation about the general structure and architecture of the program available too. But you do not necessarily have to read the lighttpd source code in order to write plugins for it. On the contrary! – Constantinius Mar 20 '12 at 15:15
  • What about Nginx? If you compare, Nginx and Lighttpd which one is easier to work with? And which is more flexible in the sense of small footprint, speed etc ? – the_naive Mar 20 '12 at 15:52
  • I'm sorry, I never comparatively analyzed these two webservers for their memory footprint and performance. – Constantinius Mar 20 '12 at 16:05
1

If you want to code a web application with C++, the Wt toolkit comes to mind.

You could also code a FastCGI ou SCGI application in C++ and register it by configuring appropriately your web server (e.g. lighttpd or the good old Apache).

And there are several libraries to make your application an HTTP server. For instance Onion (which is in C, but can be used from C++).

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547