I've been a big Apache fan since I was able to apt-get install on my Ubuntu box. Lately I've been messing around with different web servers so I thought I'd try out Lighttpd to see how it compared to Apache.
I used Apache Benchmark to run the test. All I did was run
ab -n 5000 http://localhost/
So I just sent 5000 request to localhost. First I ran Apache by itself. Here are the results:
Finished 5000 requests
Server Software: Apache/2.2.8
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 145 bytes
Concurrency Level: 1
Time taken for tests: 3.910033 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 1990000 bytes
HTML transferred: 725000 bytes
Requests per second: 1278.76 [#/sec] (mean)
Time per request: 0.782 [ms] (mean)
Time per request: 0.782 [ms] (mean, across all concurrent requests)
Transfer rate: 496.93 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 30
Processing: 0 0 1.1 0 30
Waiting: 0 0 0.1 0 6
Total: 0 0 1.2 0 31
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 1
98% 2
99% 3
100% 31 (longest request)
It wasn't too bad. Now on to Lighttpd
Finished 5000 requests
Server Software: lighttpd/1.4.19
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 145 bytes
Concurrency Level: 1
Time taken for tests: 2.60885 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 2005000 bytes
HTML transferred: 725000 bytes
Requests per second: 2426.14 [#/sec] (mean)
Time per request: 0.412 [ms] (mean)
Time per request: 0.412 [ms] (mean, across all concurrent requests)
Transfer rate: 950.08 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.5 0 31
Processing: 0 0 0.5 0 29
Waiting: 0 0 0.0 0 0
Total: 0 0 0.7 0 32
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 1
99% 1
100% 32 (longest request)
If we compare the numbers, it's obvious that Lighttpd did a better job at fulfilling the requests faster, with a higher transfer rate. For now I've switched my server over to Lighttpd. It's only used for torrentflux, vmware, and small testing sites but the switch will definitely free some resources and serve pages more quickly.
Specs
Ubuntu 8.04 Server Edition
512 Mb Ram
1266 Mhz (1.266 Ghz)
Read more about Apache versus Lighttpd