Home » High Performance, Security, Operations
Lighttpd vs Tux: nice() patch
Posted on March 25th, 2005 3 Comments »
Lighttpd by default can be slower than TUX. Why? Because TUX runs inside Linux kernel and has the highest possible priority, while lighttpd is just ordinary userspace process. Solution? Make lighttpd not so nice:
nice -20 /opt/lighttpd/sbin/lighttpd ...
Lighttpd’s Adaptive Spawning users will immediately notice a problem: all processes spawned by lighttpd will also run with the highest priority. That’s not good, since any PHP or other FastCGI process will be able to slow down lighttpd. Solution is quite simple: to restore back niceness level before launching a child process. Here’s a patch for that:
Any other ideas how this could be done?


3 Responses
[...] .1, this blog gets a makeover lighttpd tip Found a nice lighttpd tip. Lighttpd by default can be slower than TUX. Why? Because TUX runs inside Linux kernel and has the highest possib [...]
Lighttpd is not only slower than TUX because of the scheduling priority… Did you even try if modifying the priority gives any real speedup?
Lighttpd will never be as fast as TUX because simply user-space is not kernel-space.
If you want speed then use an integrated webserver/OS like SPIN… It outperforms TUX by a magnitude.
Anonymous: yes, it gives real speedup if 1) PHP runs on the same box as lighttpd and 2) PHP processes are CPU-intensive. In my case (several 100mbit links) both performed almost equally well after described change. Probably if I had 1 or 10 gigabit link I could measure the difference. Also, don’t forget that with lighty you don’t only get raw speed/large number of connections, but also an ability to upgrade without patching kernels (that’s even more important if you have other patches like grsecurity) and almost infinite configuration possibilities. Also lighttpd can’t generate panics like TUX did in the past.