[ACCEPTED]-What is the fastest webserver solution with the lowest memory footprint?-webserver
I've had a good experience with nginx (https://nginx.org/), that 10 said, when choosing a webserver, you should 9 look closely at your requirements and make 8 an informed decision as these things can 7 be very application specific.
You'll notice 6 that in this question that a lot of people 5 recommend g-wan, Webmachine, etc... these 4 are all things you should look at and benchmark 3 to see if they are faster for your use case.
This 2 is the kind of question that encourages 1 cheerleading, there is no "right answer".
As one of the authors of Webmachine, I'm 16 happy to help you out. One reason I'm following 15 up is that even though there's no JSON-related 14 code in Webmachine, you might find it useful 13 to know that we use it on a daily basis 12 for processing many different JSON requests 11 and responses. It's simple, cleanly extensible, and 10 performs reasonably well.
If you just wanted 9 static delivery, then something like nginx 8 or lighttpd would be an obvious way to go. For 7 a mix of static and dynamic requests and 6 built-in good Web behavior, you may find 5 Webmachine a good fit.
Check out the trivial 4 example code at http://code.google.com/p/webmachine/wiki/ExampleResources and the recent posts on 3 the blog at http://blog.therestfulway.com/ for more information.
It has 2 worked out well for us; if you have questions 1 feel free to drop me a line.
Cherokee webserver at www.cherokee-project.com
To measure the footprint, have a look at 6 the executable size (don't forget shared 5 libraries).
TrustLeap G-WAN (150 KB, no dependencies) offers 4 Java, C/C++, Objective-C and D scripts.
According 3 to these benchmarks, it also uses less memory 2 and CPU resources than Nginx or Lighttpd 1 while running faster:
Lighttpd has an excellent footprint, to the extent 4 that most of your memory will probably taken 3 up by whatever language you choose to use 2 (unless you go the C route, which is really 1 not recommended).
There's an article on IBM developerWorks 2 with a pretty extensive list of "lightweight" web 1 servers:
Lightweight Web servers: http://www.ibm.com/developerworks/web/library/wa-ltwebserv/
Mochiweb is super lightweight, and handles 1 a stupidly high load.
The fastest embedded web-server hands down 2 is Snorkel - checkout there web site, they 1 destroyed nginx in my testing using ab. http://sites.google.com/site/snorkelembedded
G-WAN (150 KB including ANSI C scripts) has 6 a native JSON parser, probably the fastest 5 available given the features (it lets you 4 search entries by name or by value in addition 3 to import/export from/to text).
Beating the 2 150 KB footprint (server + script engine 1 included) will be difficult.
Take a look at this. I think that's exactly 3 what the information you are looking for. You 2 don't need a full featured web server, so 1 using Erlang+libevent/libev should be good.
For C or Lua, Mongoose is an option, https://github.com/valenok/mongoose .
It 11 uses more than 5k per request, mostly because 10 the per-connection data has a buffer for 9 the request + headers preallocated, and 8 maximum request size is set to 16k by default. This 7 is tunable though, there is no problem to 6 make it less than 5k, just change
#define MAX_REQUEST_SIZE 16384 in mongoose.c 5 when you embed Mongoose. In terms of footprint, it 4 is around 50k compiled on disk not counting 3 Lua (in case you need it) and SSL (also, in 2 case you need it). Runtime footprint depends 1 on OS.
Since you mentioned Python, you might want 10 to take a look at web.py, for a very simple way 9 to listen on port 80 and map URLs to actions.
It'll 8 also run via your favorite CGI if you want 7 to pair with a standard webserver (i.e. behind 6 Nginx/FastCGI) -- and I'll second the recs 5 of Nginx for massive concurrency on static 4 files. (They used it with Lighttpd at Reddit.)
thttpd is 3 the other webserver I'd look at, especially 2 if memory is extremely scarce, like on an 1 embedded system.
Take a look at klone at koanlogic.com site 5 ... being targeted at embedded systems it's 4 very small, and incidentally very fast too: http://john.freml.in/teepeedee2-vs-klone . It 3 can be scripted in C/C++ (ultra performant) or 2 usual PHP/CGI (a lot less performant), depending 1 on skills/taste ...
If could code in C or C++, I think lighttz 10 would be the fastest and uses the least 9 memory. However, the reason why it is so 8 is because it's using libev and it has absolutely 7 nothing, no php support, no html support 6 - nothing. All it provides is a call back 5 function where u handle each http request. You're 4 are gonna have to parse the http GET/POST 3 request and return the html as a string. You 2 can see it being benchmarked against nginx, lighttpd, apache 1 etc and come up on top (link).
You could have a look at FAPWS (Fast Asynchronous 2 Python WSGI server). The philosophy of the 1 project match perfectly your needs. http://www.fapws.org
Nginx is compared to Varnish (the cache 4 used by Facebook) and Apache Traffic Server 3 (the cache used by Yahoo!):
And, Igor Sysoev, the 2 guy behind Nginx, has not been short of 1 comments on his blog.
More Related questions