Aug 2, 2007

nGinx vs Lighttpd - web server of choice

If you run and maintain a web server you are definitely interested in the web server software.
Apache is an old good friend and we all are very happy about it.
But if your load grows, you may realize that Apache with PHP eating 20-50 Mg of RAM per child is a bit too much.
This mean that you can't run more then a couple of hundreds of children simultaneously even on a powerful server. Not a big problem, how has 100 simultaneous users - you can say.
The issue is that a plain Apache server can easily be brought down.

A 5-line script opening 200+ simultaneous connections sending incomplete HTTP requests can make the server with a plain Apache stop serving requests or serve them very slowly, when the server itself will not be loaded at all.

For the cases like in the past we were puting reverse proxies in front of Apache. Now we have a better way - another web servers. Usually we choose between Lighttpd and Nginx.

The best one at the moment is Nginx - for highest speed, lowest memory consumption, ease of configuration, scalability and completeness. The negative side people find is that original documentation is written in Russian.
Here are the links for the English documentation:
Nginx wiki and Nginx - Small, But Very Powerful and Efficient Web Server

Lighty is good as well, it became famous for being used in Youtube. Especially I like the supplementary project of Lighttpd called XCache.
XCache is the fastest PHP bytecode cache at the moment and it was the first stable one compatible with latest PHP 5.2
Also, untill recently Lighttpd had the only usable FCGI process management tool. Now we have PHP-FPM (docs are in Russian as well).

Here I accidentally met someone's blog record about Lighty/nGinx comparison and hints for setting up nGinx: Nginx, my new favorite front end for mongrel cluster


Hope this links helped.

1 comment:

Anonymous said...

yep, i've begun to love nginx, it's a very fast webserver and perfect for rails apps.

i've posted a load of articles to help you out and included script downloads on my site if you wanna have a look,

red91.com