[Solved]-Apache or lighttpd


The way you interface between the web server and Django might have even a greater impact on performance than the choice of web server software. For instance, mod_python is known to be heavy on RAM.

This question and its answers discuss other web server options as well.

I wouldn’t be concerned on compatibility issues with client software (see MarkR’s comment). I’ve had no such problems when serving Django using lighttpd and FastCGI. I’d like to see a diverse ecosystem of both server and client software. Having a good standard is better than a de facto product from a single vendor.


The benefit of both: Apache is more powerful and extensible (useless if you don’t need that power, but anyway…) and lighttpd is faster at static content. The idea is of splitting your site into static content (css, js, images, etc) and dynamic code that flows through Apache.

I’m not saying you can’t do a lot with lighttpd on its own. You can and people do.

If you’re using lighttpd exclusively on your production server, I would seriously consider mirroring that on your development and staging servers so you know exactly what to expect before you deploy.



For purely static web pages (.gif, .css, etc.) with n http requests from distinct ip addresses:
1. Apache: Runs n processes (with mod_perl, mod_php in memory)
2. lighttpd: Runs 1 process and 1 threads (You can assign m threads before launching it)

For purely dynamic web pages (.php, .pl) with n http requests from distinct ip addresses:
1. Apache: Runs n processes (with mod_perl, mod_php in memory)
2. lighttpd: Runs 1 lighttpd process thanks to async I/O, and runs m fast-cgi processes for each script language.

Lighttpd consumes much less memory. YouTube used to be a big user of lighttpd until it was acquired by Google. Go to its homepage for more info.

P.S. At my previous company, we used both with a load balancer to distribute the http traffic according to its url suffixes. Why not fully lighttpd? For legacy reasons.



The answer depends on your projects goals. If it’s going to be a large scale site where uptime is critical and load is hight go with lighttpd; it scales amazingly. The only downside is that you have to be more hands on initially. Most hosts won’t support this and it really pays to know what you’re doing with lighttpd.

If it’s a site for your mother that’ll get a few thousand visitors a month apache’ll work better. She’ll be able to move to a new host a lot easier and support is easier to find.


Use a standard web server. Apache is used by 50% of web sites (Netcraft), therefore, if you use Apache, peoples’ web browsers, spiders, proxies etc, are pretty much guaranteed to work with your site (its web server anyway).

Lighthttpd is used by 1.5% of web sites (Netcraft), so it’s far less likely that people will test their apps with it.

Any performance difference is likely not to matter in production; an Apache server can probably serve static requests at a much higher bandwidth than you have, on the slowest hardware you’re likely to deploy in production.


Leave a comment