Debunking lighttpd.

lighttpd is a relatively new webserver. It has quite a few good features. The major design choice, is for it to be completely single threaded and single processed. This means all dynamic content generation is done via FastCGI.

On the sidebar, they have a wonderful link to their benchmarks. Now, we all know that benchmarks are mostly fake, and ApacheBench is one of the worst available tools for doing benchmarks. They make some great claims on their benchmark page:

Quote from http://www.lighttpd.net/benchmark/ :
lighttpd + fastcgi is more than 25% faster than apache + mod_php4.
For static files we already know that lighttpd is 4-6 times faster.
lighttpd is 4-6 times faster in every setup than apache and outperfoms thttpd for large files.

(emphasis is mine)
Well, I can’t stand people perpetuating the myth that Apache HTTPD is slow. I agree, it will never be the fastest in the world, but is is not slow. Therefore, I did some benchmarking of my own.

Hardware
Client:

Linux 2.6.8-2-k7
Debian Unstable
AMD Athlon(tm) XP 1800+
512 MB RAM
RTL-8169 Gigabit Ethernet

Server:

FreeBSD 6.0-CURRENT (Custom Kernel, debugging disabled)
AMD Athlon(tm) XP 1500+
256 MB RAM
3C905-TX Fast Etherlink XL PCI 10/100

Both machines are connected to a 24 port 10/100 switch. Nothing super amazing on the hardware size.

Software
lighttpd:

Version: 1.3.14
Configure Line: ./configure –prefix=/home/chip/bench/lighttpd –with-openssl
Config File: lighttpd.conf

Apache HTTPD:

Version: 2.1.6-alpha
Configure Line: ./configure –with-mpm=worker –prefix=/home/chip/bench/httpd \
–enable-cache=shared –enable-disk-cache=shared \
–enable-nonportable-atomics –enable-mods-shared=all \
–enable-ssl=shared
Config File: httpd.conf

The Test
I grabbed a copy of the Slashdot Frontpage. 62686 Bytes long. This file was request 10,000 times at each concurrent client level. gzip/delfate compression was enabled on both lighttpd and Apache httpd.

The Graph

Insightful Commentary
Oh shit. lighttpd isn’t faster.

Both servers are able to max out the 100mbit LAN after awhile, but Apache HTTPD got to the point first.
Will the people who have >= 1 Gigabit Internet Connections to their servers please stand up?
Yes, you two who pay way too much money, and don’t actually use that much bandwidth, you don’t count.
Yahoo might count, but everyone else sit down. It doesn’t matter which server you use, since both can easily flood your entire maximum outgoing bandwidth.

Conclusion
Changing your webserver doesn’t solve real performance issues. Look at your 200,000 lines of PHP code and slow SQL first.

Disclaimer
Apache httpd had an unfair advantage. I am an Apache Developer, and breath it every single day.

I have no personal grudge against lighttpd, or it’s developers.

I don’t accept that Apache httpd should be slow, and I don’t believe their benchmarks are entirely truthful. Don’t let the myth continue.

Update 7/05/05: I replied to several comments in another post.

4 Responses to “Debunking lighttpd.”

  1. finalbsd’blog » Web Server Comparasion Says:

    [...] 当然也有人嚷嚷:lighttpd在扯蛋 (当然我们得注意一下这家伙的背景) [...]

  2. Delavec Says:

    [...] http://www.debianhelp.co.uk/lighttpd.htm http://journal.paul.querna.org/articles/2005/06/24/debunking-lighttpd [...]

  3. yoandy Says:

    Hi paul,

    I don’t have numbers nor graphs right now to “backup” what i’m about to say.

    I admin a site that takes around 31.000 simultaneous hits at peak hours,

    Using 4 long-time-tweaked apache web servers this site took those 4 (dedicated) server to their knees.

    i tried my best not taking apache away, i swear, it took me 2 weeks (with work-days of 12hours, sometimes more) of tunning, balances, caches, proxies, php code and sql tuning; until i decided to test lighttpd.

    Now Lighttpd is not only serving this site very well but is also serving 3 other sites on the same 4 servers and there is room for more.

    don’t take me wrong, i actually think apache is a great software.
    My 2 points are:

    1- as you already said: Lighttpd outperforms Apache
    2- changing the web server soft DO (can) solve performance problems (at least in my case, this is not an absolute statement applicable to everyone)

    to let you be happy let’s say: maybe i just did not made the right conf for apache. I think i did :)

  4. Harish Says:

    Hi Paul,

    Again thanks for the wonderful coverage of this performance stats, i agree that as a web-server apache is good choice, but not as forward proxy or reverse proxy.

    Do you have any performance data on Apache and lighty in proxy mode ( forward and reverse)?.

    -thanks
    Harish

Leave a Reply