In late December I started looking at alternative web servers, having hit a point where I actually asked aloud (though to no one in particular) why I still use Apache for any http or php needs that may arise.
I sat down, installed nginx (nginx 0.6.33) from the EPEL (Extra Packages for Enterprise Linux) repositories and lighttpd (lighttpd 1.4.20) from the RPMforge repositories (both third party repositories worth writing about in detail at a later date). Apache was already installed (httpd 2.2.3), so a virtualhost was configured to serve data from the same docroot using all three servers, and PHP through fastcgi was configured for lighttpd and nginx1.
I then set up a stock WordPress 2.7 blog, some large images, some thumbnails, and created what amount to approximately a 20k index page with nothing cached. Using ApacheBench to fetch 1000 requests, 100 requests at a time, I came up with some simple numbers showing how long it took to return the same page for each web server.
While I openly admit that the benchmarks produced here are arbitrary and superficial, they do give some rough insight (10,000ft overview level insight) as to how much faster nginx and fastcgi are over apache 2.2 and mod_php. lighttpd also performed admirably, and with less hassle involved in set up than nginx, but I suspect that may just be previous familiarity with the configuration.
A table of numbers (soon to be a graph, when I feel like making it) and some thoughts as to what they mean and why we (the web hosting community) still use Apache religiously follows after the jump.
-
Credit where credit is due. I couldn't have started to work out the nginx fastcgi configuration without help from this post on redemption in a blog. ↩