Benchmark: Apache2 vs. Lighttpd (Images)

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Tue, 2008-10-14 12:00. :: Apache | Lighttpd

Benchmark: Apache2 vs. Lighttpd (Images)

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 09/16/2008

This benchmark shows how Apache2 (version 2.2.3) and lighttpd (version 1.4.13) perform compared to each other when delivering an image file (jpg, about 25KB in size). This benchmark was created with the help of ab (Apache benchmark) on a VMware vm (Debian Etch); if you try this yourself, your numbers might differ (depending on your hardware), but the tendency should be the same.

 

Preliminary Note

I have tested this on a Debian Etch system with 512MB RAM inside a VMware vm on a system with an Intel(R) Pentium(R) M processor 1400MHz (yes, quite old, but as I said in the introduction, the tendency should be the same on other hardware).

Apache 2.2.3 mpm-prefork with default Debian configuration.

Lighttpd 1.4.13 with default Debian configuration.

The image file is 25KB in size and called test.jpg.

I've run the following commands ten times each and calculated the average requests per second that the web server could handle:

ab -n 100 -c 5 http://192.168.0.100/test.jpg

ab -n 1000 -c 5 http://192.168.0.100/test.jpg

ab -n 10000 -c 5 http://192.168.0.100/test.jpg

ab -n 100 -c 50 http://192.168.0.100/test.jpg

ab -n 1000 -c 50 http://192.168.0.100/test.jpg

ab -n 10000 -c 50 http://192.168.0.100/test.jpg

ab -n 100 -c 100 http://192.168.0.100/test.jpg

ab -n 1000 -c 100 http://192.168.0.100/test.jpg

ab -n 10000 -c 100 http://192.168.0.100/test.jpg

-n is the number of requests to perform for the benchmarking session; -c is the number of multiple requests to perform at a time.

 

ab -n 100 -c 5 http://192.168.0.100/test.jpg

Apache: 540,14 requests/second

Lighttpd: 608,71 requests/second (+ 12,69%)

 

ab -n 1000 -c 5 http://192.168.0.100/test.jpg

Apache: 1146,94 requests/second

Lighttpd: 1408,45 requests/second (+ 22,80%)

 

ab -n 10000 -c 5 http://192.168.0.100/test.jpg

Apache: 2111,64 requests/second

Lighttpd: 2646,44 requests/second (+ 25,33%)

 

ab -n 100 -c 50 http://192.168.0.100/test.jpg

Apache: 509,01 requests/second

Lighttpd: 551,21 requests/second (+ 8,29%)

 

ab -n 1000 -c 50 http://192.168.0.100/test.jpg

Apache: 1095,03 requests/second

Lighttpd: 1282,62 requests/second (+ 17,13%)

 

ab -n 10000 -c 50 http://192.168.0.100/test.jpg

Apache: 1816,61 requests/second

Lighttpd: 2266,33 requests/second (+ 24,76%)

 

ab -n 100 -c 100 http://192.168.0.100/test.jpg

Apache: 484,80 requests/second

Lighttpd: 485,07 requests/second (+ 0,06%)

 

ab -n 1000 -c 100 http://192.168.0.100/test.jpg

Apache: 1073,90 requests/second

Lighttpd: 1276,06 requests/second (+ 18,82%)

 

ab -n 10000 -c 100 http://192.168.0.100/test.jpg

Apache: 1729,61 requests/second

Lighttpd: 1985,28 requests/second (+ 14,78%)

 

Complete Graph


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by thanhlangso (registered user) on Tue, 2012-10-23 05:20.

How to create Graph for each test?

Can you tell me how to create graph for tested result?

Thanks.

Submitted by Anonymous (not registered) on Tue, 2010-07-27 01:19.

Why does it matter whether -n is 100, 500, or 10000? Once one request is complete, the image should be in the page cache and should take the same amount of time to serve up. I don't understand why the number of requests/second increases so significantly as the number of requests increases.

 Anyone know why?

Submitted by Anonymous (not registered) on Tue, 2009-02-24 21:12.

Uh, if you're comparing two quantities like that, requests per second of a test jpeg for 2 servers, your bar graphs REALLY ought to have 0 as the lower axis. Not 500, or 1600, or any other value. Doing it the way these graphs have been done is hugely misleading to anyone casually perusing the data. Sure, lighttpd is faster by these metrics. But not by as much as these graphs lead one to believe. (unless you're paying really close attention.)

 

Submitted by Anonymous (not registered) on Mon, 2014-02-03 23:48.
Yep. I agree.
Submitted by ibague (not registered) on Wed, 2009-08-26 02:37.
i was about to say the same thing!
Submitted by ZebX (not registered) on Thu, 2009-02-12 20:17.

Just some remark ab read only 4Ko header http include and launch a new call, see source code. This is not a human behavior. You don't use keepalive, so you test essentially timing to get new connection. Nobody use web server with default configuration and no module. This sort of test could be more interresting with configuration following Apache recommendations, with some modules like apache+mod_deflate+mod_php+mysql, and another perf tool like httperf or better siege.

Submitted by Michael (not registered) on Sat, 2008-12-20 09:46.

Apache has several threading models.  You used the slowest (and default on Debian).  Try looking at Debian modules "apache-mpm-worker" (a threaded implementation) or "apache-mpm-event" (a similar model to lighttpd).

"The worker MPM provides a thread implementation for Apache HTTPD. It is considerably faster than the traditional model, and is the recommended MPM."

 "The event-Multi-Processing Module (MPM) is designed to allow more requests to be served simultaneously by passing off some processing to work to supporting threads..... "

 The pre-fork model that you tested with is the "safest" but not the fastest (ie, not a danger for non-thread safe libraries).

Submitted by mdani (not registered) on Wed, 2008-10-15 04:53.

Hi Falko. Nice Article.

When you do the test, is that between test to another test you do a restart the apache/lighty, i guest it would make a different change.. :)

Submitted by bennos (not registered) on Tue, 2008-10-14 14:53.
this is not a typical benchmark. You used just a JPG File. This is more a bechnmark for http downloads over apache and Lighty.
Submitted by Webseiter (not registered) on Tue, 2008-10-14 13:37.
As for the lighttpd development seems to be relatively slow nginx seems to be quite popular these days. How about a comparison between those three?