Wordpress Lighttpd vs. Apache Httpd Perfomance Test

by admin on Monday, August 24th, 2009

This is a Wordpress permance test using Lighttpd (which is a faster alternative to Apache) and Apache Httpd on a test server loaded with a real blog.  All tests were done from empty load of zero.

For testing, I’ve used a virtual dedicated server from MediaTemple, specifically their dv Extreme server which touts 2GB of ram and virtual quad-core CPU performance.

I did an initial test with Lighttpd and  found that Lighttpd outperforms Apache Httpd by 2-10 times faster on images. If you have a blog with image on every blog post, you can probably expect a lot of performance improvements in loading times and also be able to handle 2-10 times more traffic from the same hardware.

The below are my test results on a test server loaded with real-world blog with 28MB of MySQL database and 30KB image on every blog post with about 80KB of images on the homepage, which is the page this test is based on.

Total bytes of the test blog homepage is 129KB.

For all tests, Wordpress Super Cache plugin and Super Cache Glib Compression (Php.ini zlib.output_compression = 9) was turned on.

For Lighttpd, there were 2 different versions of mod rewrite to make Super Cache work:

  • Lighttpd with Mod_Rewrite and Mod_Magnet based on asteriosk.gr method.  This method supposedly improves upon the Tempe.st method  below but I did not notice any performance improvements.
  • Lighttpd with Mod_Magnet based on Tempe.st method.  This uses Lighttpd coupled with Mod_Magnet module, which is Lighttpd substitute/alternative to Apache’s mod rewrite .htaccess file.

I’ve used the following ab parameters, 1000 connections with 5 concurrent connections.

ab -n 1000 -c 5 http://testsite.com/index.php

Here’s test results for Apache Httpd

Only PHP was enabled for Apache, everything else turned off.  PHP and Httpd were both optimized as much  as they can be.

Max Load: 6.37

Max Memory: 337MB
Time taken for tests:   86.480747 seconds
Requests per second:    11.56 [#/sec] (mean)
Time per request:       432.404 [ms] (mean)
Time per request:       86.481 [ms] (mean, across all concurrent requests)
Transfer rate:          3.33 [Kbytes/sec] received

Percentage of the requests served within a certain time (ms)
50%    378
66%    442
75%    501
80%    542
90%    657
95%    737
98%    908
99%   1039
100%   2112 (longest request)

Lighttpd with Mod_Rewrite and Mod_Magnet

based on asteriosk.gr method.

Max Load: 3.04

Max Memory: 264MB

Time taken for tests:   81.85927 seconds
Requests per second:    12.33 [#/sec] (mean)
Time per request:       405.430 [ms] (mean)
Time per request:       81.086 [ms] (mean, across all concurrent requests)
Transfer rate:          3.33 [Kbytes/sec] received

Percentage of the requests served within a certain time (ms)
50%    323
66%    456
75%    517
80%    535
90%    637
95%    738
98%    917
99%   1001
100%   1357 (longest request)

Lighttpd with Mod_Magnet

based on Tempe.st method.

Max Load: 3.00

Max Memory: 261MB

Time taken for tests:   82.267440 seconds
Requests per second:    12.16 [#/sec] (mean)
Time per request:       411.337 [ms] (mean)
Time per request:       82.267 [ms] (mean, across all concurrent requests)
Transfer rate:          3.28 [Kbytes/sec] received

Percentage of the requests served within a certain time (ms)
50%    339
66%    416
75%    516
80%    546
90%    673
95%    777
98%    863
99%    952
100%   1184 (longest request)

For Lighttpd, I did 2 different versions that were currently available out there for working with Wordpress Super Cache’s mod rewrite code.

I found that the Lighttpd in general was faster, memory fluctuated at 250-265MB, and maximum load was at about 3.0 during the testing. (for both Lighttpd versions, I saw negligence in improvement of performance between the 2 codes)

In contrast, the Apache Httpd was much more slower and gobbled up memory.  The Httpd reached about the double load of Lighttpd at 6.37, memory kept rising from cold start 250MB to 337MB until the end of the ab test.

Conclusion

Lighttpd is more efficient with memory, the test server at zero load used up about 250MB of memory.  During the testing, Lighttpd never used more than 6MB of memory at max  while Httpd used 87MB of memory.  That’s about 87/6= 14.5 times better use of memory by Lighttpd.

For server load, I noticed that Lighttpd reached load of about 3.0 but when the test was over, the server load came down very quickly in comparison to Apache Httpd, which reached load of 6.37 and took a lot longer for the load to settle.

For those of you who need friendly permalinks and Wordpress Super Cache, my advice is to go with the Lighttpd with Mod_Magnet based on Tempe.st method.  It seemed that this is the simplest method to make it work since you don’t need any hardcoded code.

I will have a step-by-step instructions on how to convert your existing Plesk server to run Lighttpd so watch out for that next.

Using Lighttpd could possibly save you thousands of dollars on server fees as your website will be able to handle more web traffic (possible 2-10 times more!) and your site will load much faster, meaning your blog readers/visitors will enjoy the blog more.

ab -c 1000 -n 5 http://doyoureallywant.com/index.php

Rate


Categories: Performance Tests.

Related News and Resources