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.
- Processor: Intel Core2Quad Q6600
- Memory: 4 GB DDR2 800 MHz ECC
- Storage: 500 GB 7200 RPM SATA Hard Drive
Benchmark Software and Configuration:
- OS: Ubuntu 10.04 LTS AMD64
- Benchmarking Tool: ApacheBench, Version 2.3
- Apache 2/PHP Configuration (Running with mod_php): phpinfo.apache2
- Cherokee 1.0.1/PHP5-FPM Configuration: phpinfo.cherokee
- LigHTTPd/PHP5-FPM Configuration: phpinfo.lighttpd
- Nginx/PHP5-FPM Configuration: phpinfo.nginx
- No PHP Caching systems were installed in order to test the servers in bare-bones.
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.
- 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.
- 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.
- 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.