[Benchmark] Apache 2, Cherokee, LigHTTPd, Nginx Benchmarked with Static Files, PHP5 Script and WordPress

Here is a three fold comparison between the four major webservers: Apache 2, Cherokee, LigHTTPd and Nginx. We will compare standard static file service capabilities of each of the servers. Next, we will compare their individual performance with PHP (mod_php in-case of Apache 2 and PHP5-FPM in-case of others) and finally with that of WordPress.

Benchmark Hardware:

  1. Processor: Intel Core2Quad Q6600
  2. Memory: 4 GB DDR2 800 MHz ECC
  3. Storage: 500 GB 7200 RPM SATA Hard Drive

Benchmark Software and Configuration:

  1. OS: Ubuntu 10.04 LTS AMD64
  2. Benchmarking Tool: ApacheBench, Version 2.3
  3. Apache 2/PHP Configuration (Running with mod_php): phpinfo.apache2
  4. Cherokee 1.0.1/PHP5-FPM Configuration: phpinfo.cherokee
  5. LigHTTPd/PHP5-FPM Configuration: phpinfo.lighttpd
  6. Nginx/PHP5-FPM Configuration: phpinfo.nginx
  7. No PHP Caching systems were installed in order to test the servers in bare-bones.

Benchmark Process:

All the above were installed on the same test system using standard Ubuntu Packages or stable PPA packages wherever necessary. Each of these servers were tested for finding three different results. The first one was a static file test. In this test, two PNG type images of dimensions 400×400 and 800×800 pixels were taken. Each server was made to benchmark on each of the two images and for each image two iterations per server using ApacheBench were taken. The output Requests Per Second was averaged over all iterations of each server. While running tests on each server all the others were gracefully brought down. Next was the PHP5 Script test. Here a simple php script with a for loop of 100 iterations of word “Testing” was used to benchmark with two iterations per server and the results were averaged. Finally, we took the WordPress test. Here the same WordPress installation was accessed by each of the servers. WordPress permalinks were disabled. The request WordPress post had one post and 5 nested comments to test for load. Again two iterations for the same were taken per server and the data was averaged. The Static File Test and PHP Script Tests were taken with 50000 requests at a concurrency level of 100. The WordPress Tests were taken with 3000 requests at a concurrency level of 5.

The Results:

  1. Static Image Test: In this test Nginx and LigHTTPd were comparably similar in results and were better than Apache2 and Cherokee by at-least 25%. Cherokee which is known for its Caching features didn’t show any remarkable results and performed way below our expectations.
  2. PHP Script Test: We decided to use Apache2 with default mod_php but the rest with the php5-fpm FastCGI configuration. As expected Apache2 topped our results because of the fact that it was running on mod_php but the rest were running in FastCGI mode where the php5-fpm was the bottleneck. Nginx was considerably better than the rest.
  3. WordPress Test: From the results it is apparent that  MySQL queries were the bottle neck which restricted all the servers to almost the same low score. Here purposefully  no caching mechanism was used with WordPress, so that it can be tested bare-bones on each of these servers. Had there been a caching in place,  the results would have been similar to the Static Image Test.

That’s all for now. Next week,  we will come up with some more benchmarks.

This entry was posted in Benchmarks and tagged , , , , , , , , , . Bookmark the permalink.

12 Responses to [Benchmark] Apache 2, Cherokee, LigHTTPd, Nginx Benchmarked with Static Files, PHP5 Script and WordPress

  1. Pingback: Tweets that mention [Benchmark] Apache 2, Cherokee, LigHTTPd, Nginx Benchmarked with Static Files, PHP5 Script and WordPress | TechTatva -- Topsy.com

  2. pavel says:

    maybe you will include to comparison yaws?

  3. pavel says:

    and maybe change php version up to 5.3.3 with php-fpm bundled?

    • techtatva says:

      Hi Pavel,

      We will be adding more benchmarks with different configurations soon, so keep watching this space.

      Regards,
      The TechTatva Team

  4. Pingback: Revue de presse Industrialisation PHP des semaines 32 à 38 (2010) | Industrialisation PHP

  5. Damien says:

    Interesting benchmark. Just one question : did you disable AllowOverride in the Apache config ?

    • techtatva says:

      Hi Damien,

      Yes AllowOverride was enabled. As for most production deployment of Apache for PHP it would be set to all by default, we decided to leave it to “all” for our benchmarks also.

      Regards,
      The TechTatva Team

  6. David says:

    Not quite bare-bones for php as you have byte-code caching enabled according to the phpinfo() output. Would also be interested in seeing the benchmarks Apache with php run as (f)cgi, as I find it to be a more common setup than mod_php these days.

  7. Christian says:

    Can you Add please Hiawatha ?
    http://hiawatha-webserver.org

  8. Evert Meulie says:

    ‘Next week, we will come up with some more benchmarks.’

    Next week coming up soon? 😉

  9. Norton says:

    See Apache, Cherokee, G-wan, IIS 7.0, Kloned, Lighttpd, Nginx and Ulib benchmarked:

    http://dsec.com/imgs/gwan-lighttpd-nginx-cherokee.png

    Linux 32-bit, static file (100 bytes) 1-1,000 simultaneous clients.

  10. Hugo says:

    Time for a new benchmark session?

Leave a Reply

Your email address will not be published. Required fields are marked *