Benchmark: Apache2 vs. Lighttpd (Static HTML Files)

Version 1.0
Author: Falko Timme
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 a static HTML file (about 50KB 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 HTML file I've used to test is a copy of the HowtoForge frontpage with a size of 49128 bytes. I've saved it as test.html.

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://localhost/test.html

ab -n 1000 -c 5 http://localhost/test.html

ab -n 10000 -c 5 http://localhost/test.html

ab -n 100 -c 50 http://localhost/test.html

ab -n 1000 -c 50 http://localhost/test.html

ab -n 10000 -c 50 http://localhost/test.html

ab -n 100 -c 100 http://localhost/test.html

ab -n 1000 -c 100 http://localhost/test.html

ab -n 10000 -c 100 http://localhost/test.html

-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://localhost/test.html

Apache: 437,58 requests/second

Lighttpd: 562,41 requests/second (+ 28,53%)

 

ab -n 1000 -c 5 http://localhost/test.html

Apache: 627,60 requests/second

Lighttpd: 749,15 requests/second (+ 19,37%)

 

ab -n 10000 -c 5 http://localhost/test.html

Apache: 916,70 requests/second

Lighttpd: 1181,18 requests/second (+ 28,85%)

Share this page:

10 Comment(s)

Add comment

Comments

From: at: 2008-09-23 03:13:31

The apache is from the latest verion of WHM, without any twisting, and the concurrency request is 500, it's also too large to most of common websites. It's not a performance benchmark bwteen apache and lighttpd, but may proved the following two things:


- The default configured apache that provided by hosting providers is not a good choice, some twisting is needed.


- *Seems* that lighttpd with PHP running in FastCGI mode is a little better than working with some addtional memory management tools.(maybe wrong, need some further testings)


Thanks


-joseph

From: at: 2008-09-19 16:30:52

I also did a benchmark among apache-2.63, lighttpd-1.4.19( PHP in FastCGI with eAccelerator), lighttpd-1.4.19( PHP in FastCGI without eAccelerator):


It's here: http://admon.org/uploads/doc/Apache-Lighttpd-with-FastCGI-Benchmark.html


Additionlly, three types of files are tested:


1, Dynamic PHP files with single command phpinfo();


2, Median size HTML file, 24KB


3, Large size JPG file, 188KB


Details is here

From: Anonymous at: 2008-09-22 14:41:51

You seem to have a problem in your test since all apache2 fields are filled with "apr_socket error" And I frankly would not believe that it is Apache2 is guilty that your test failed.

From: dim at: 2008-09-22 07:50:29

You should use other tools for HTTP testing, 'ab' has a very limited scalability!


As workaround, you may start more 'ab' processes to reach higher workload, but using other tool anyway will give you a more realistic view...


Rgds,


-dim

From: admin at: 2008-09-18 23:50:18

I did it with OpenOffice Calc.

From: at: 2008-09-18 21:30:18

What program you used for creating of charts ?

From: ZebX at: 2008-09-18 18:46:54

ab do not represent human comportment and test other limits than web server during this simple test...

From: Anonymous at: 2008-09-19 05:53:03

can you repeat apache tests with worker-mpm ?

From: Christian Folini at: 2008-09-19 07:45:06

This is not a very elaborate, but it gives a clear understanding of raw performance on static files.


I expected to see more difference, now I know more.


Thank you for your work, Falko.

From: Nuno at: 2008-09-25 10:18:21

But i dont understand, what you have better performance? And with php file which is better?