Quick Benchmark of Apache, Nginx, Cherokee, Lighttpd
A short benchmark of this 4 server with dynamic and static content.
All server provides the same functionality like URL rewriting, password protected folders/files etc. but all have their own way to do that
For shared hosting where the user has no access to the server configuration, Apache with the .htaccess file support is a good choice.
I used the benchmark tool from Apache ab -n 50000 -c 20
php-cgi goes over a Unix socket
Dynamic Content (PHP)
| Server | Requests (sec) | Transferrate (KB/s) |
| Apache 2.2.14 | 2125 | 11684 |
| Nginx 0.7.65 | 1734 1861 |
9436 (php-cgi) 10115 (php-fpm) |
| Cherokee 1.0.0 | 2119 2103 |
11562 (php-cgi) 11454 (php-fpm) |
Static content (14785 Bytes HTML file)
| Server | Requests (sec) | Transferrate (KB/s) |
| Apache 2.2.14 | 6768 | 99593 |
| Lighttpd 2.4.26 | 15782 | 213866 |
| Cherokee 1.0.0 | 7602 | 111285 |
| Nginx 0.7.65 | 10912 | 159828 |
More “real live” test with PHP and eAccelerator enabled
Cherokee/NGinx/Lighttp are using the same php-fpm socket
| Server | Requests/s | Ø |
| Apache 2.2.14 | 2713|2744|2766 | 2741 |
| Nginx 0.7.65 | 2416|2433|2418 | 2422 |
| Cherokee 1.0.0 | 2702|2638|2694 | 2678 |
| Lighttp 1.4.26 | 2492|2363|2540 | 2465 |
Results
There is a small difference between fast-cgi and php-fpm (alternative implementation of fast-cgi).
You should prefer php-fpm (will be included in PHP 5.4 or you must build it manually from source).
Apache and Cherokee are both excellent for dynamic content.
For static content Lighttp is the fastest server.
There is not _the_ best server but a good combination: Lighttpd or Nginx as a proxy for serving static content, Apache or Cherokee for the dynamic content. Or a another proxy server like Varnish for static content and caching and Apache/Cherokee for serving dynamic content
For a PHP site with only 1 server running: Apache.
For a smaller memory footprint and if .htaccess is not needed: Cherokee (also the only server with a very good graphical admin interface)


English
Deutsch


