Lighttpd vs nginx
From WikiVS, the open comparison website
| Lighttpd | Nginx | |
|---|---|---|
| VS
|
|
| http://www.lighttpd.net | http://wiki.nginx.org |
Lighttpd and ngnix are open-source HTTP servers for the *nix platform. Both are very configurable and fast, and are lightweight compared to Apache. They were designed to be massively scalable and solve the C10k problem.[1]
Contents |
Architecture
Both Lighttpd and nignx are asynchronous servers.
Nginx and Lighttpd are probably the two best-known asynchronous servers and Apache is undoubtedly the best known process-based server. [...] The main advantage of the asynchronous approach is scalability. In a process-based server, each simultaneous connection requires a thread which incurs significant overhead. An asynchronous server, on the other hand, is event-driven and handles requests in a single (or at least, very few) threads. [...] Pulling numbers from thin air for illustrative purposes, serving 10,000 simultaneous connections would probably only cause Nginx to use a few megabytes of RAM whereas Apache would probably consume hundreds of megabytes (if it could do it at all).
Lighttpd runs as a single process with a single thread and non-blocking I/O.
nginx works as one master process but delegates its work unto worker processes.
Stability
As of August 2009, lighttpd still has unsolved memory leaks issues reported 3 years ago.[2]
One problem with Lighty is that it leaks memory like a sieve. I audited it for a little bit and I gave up, it's a mess. I'd steer clear of it, it will quickly ruin your day if you throw a lot of traffic at it.
— Bob Ippolito in the TurboGears mailing list, 2006-08-24
Performance
nginx is noted to be a good server for sites that need fast, efficient reverse proxies [3], [4], [5] or fast, efficient serving of static content [6]. It is acclaimed for having low memory usage and is recommended for sites running on a VPS[7].
Both servers performed extremely well, though it seems that Lighttpd might perform best in a more fragmented file system (smaller files). [...] Considering that each would easily saturate the pipeline I doubt a real-world performance difference would be seen.
Blog post comments support the fact that the difference in performance is negligible and indicate that nginx uses less CPU than lighttpd:
- in my simple stress tests cpu usage showed lighttpd at 98% while nginx was never more than 52%.
- Nginx performed almost the same as lighttpd but cpu load was much better with nginx. (LA never got more than 5 while lighttpd bumped it up to ~10, and apache to 20+ while testing with the wordpress setup) Btw, can't even compare it to apache, which almost crashed my box when testing the sample wordpress install.( 10000 requests, 1000 concurrent)
- The difference in speed between lighttpd and nginx is really negligible, as you see nginx might outperform lighttpd on some workloads and vice versa with other workloads. What really matters is stability, CPU consumption, and ease of use. And nginx really beats lighttpd there - by far.
Features
Both Lighttpd and nginx support modules that enhance functionality. They try to balance the number of built-in modules for performance reasons.
IPv6
Lighttpd has had support for IPv6 for a long time.
IPv6 support for nginx is in the works.
Backends
Lighttpd has support for CGI [8], FastCGI [9] and SCGI [10] via modules.
Lighttpd is capable of automatically spawning FastCGI backends as well as using externally spawned processes.
nginx has module support for FastCGI via a built-in module, SCGI and WSGI via 3rd Party module. The user must be able to spawn the processes separately because nginx is not able to automatically spawn them [11]. nginx does not support normal CGI applications [12], which is actually a security benefit.
Memcached
Nginx has built-in support to communicate directly with memcached. This is particularly useful for super-fast delivery of pages that are cached in memcached by a background process or a web application [13].
Lighttpd supports similar features through its mod_cml module.
X-Sendfile
X-Sendfile is a feature that allows scripts or web applications to send files on the filesystem that are restricted by the web server (nginx / lighttpd) by having the script send a special header.
Lighttpd accomplishes this by using the X-Sendfile header with an absolute file path. nginx has a more restricted feature using the X-Accel-Redirect header that allows for relative file paths from a predefined location [14].
Separated error logging per virtual server
Lighttpd's author intentionally refused to support this feature, despite user requests [15].
Nginx supports separate error logging per virtual server [16].
Support
Lighttpd has been popular in the United States for longer than nginx and is known to have many modules.
Lately I've gotten fed up with Lighttpd. There's been outstanding bugs that are so familiar they've acquired names. The project's lead, Jan Kneche, seems more interested in schmoozing up to the Rails crowd than providing a decent product
The greatest hindrance for a wide adoption of nginx was a lack of English support. There has been much improvement in this regard, however, and there is now an English Wiki providing good documentation of nginx's features, albeit suffering from bad English grammar and lack of structure and coverage.
Bug tracking
Lighttpd has a full-blown bug tracking system powered by Redmine.
nginx has a poor man's bug tracking system in the form of a wiki page, which as of 2009-08-16, lists only one bug, dating from 2007-11-11.
IRC support
Both Lighttpd and nginx have IRC channels on the freenode.net server (#lighttpd and #nginx), but the nginx channel is very quiet, with long delays between responses to user questions [17].
Popularity
According to the January 2009 Netcraft survey, nginx hosted about 15% more domains than lighttpd. Netcraft dropped lighttpd from its statistics since its February 2009 report.
Links
- http://blog.grik.net/2007/08/nginx-vs-lighttpd-web-server-of-choice.html
- http://hostingfu.com/article/nginx-vs-lighttpd-for-a-small-vps
Pro nginx
- Switching from lighttpd to nginx
- http://brainspl.at/articles/2006/08/23/nginx-my-new-favorite-front-end-for-mongrel-cluster
- http://calomel.org/nginx.html Nginx "HOW TO" explaining the advantages of this fast and secure web server


del.icio.us
digg
Furl
reddit
Slashdot