It has come to my attention, when a client of mine recently experienced unexpected traffic spike, that some industry standard solutions not always work or should i say not 100% reliable all the time. My client’s server setup was an-old-school Apache 2.2/mod_php WordPress blog installation. One day they posted some “hot-buzz” celebrity photos and server had become non-responsive under the traffic flow. Of course, at that time i was unaware about high-availability setups and never imagined scenarios like this one, when you get monthly volume of visitors during the 24 hour period.
Since then i have researched a lot of places online and found, that Apache web server is not the only solution to the hosting setup problem. Many others exist and those others, event quite “beta”, allow for the great tolerance for the high volume traffic.
Today i’d like to share with you my test results for my current server setup – LEMP or Linux, nginx (Engine-x), MySQL, PHP-FPM versus my old setup for this blog: LAMP – Linux, Apache, MySQL, PHP. Both of those are on the Linode VPS (Linode 360). Before getting rid of the old server configuration i booted it one more time and ran tests using guys from LoadImpact to determine how will each of these survive under the load of 10-20-30-40-50 simulations requests.
So here we are with the performance under the load for the LAMP config:
As you can see this test had timed out at 40 clients – Apache simply took too long to serve all of those. I was also trying to work with a website to post something on the blog and experienced a delay of about 30 seconds to load the page.
Here is the LEMP test:
As you see from above – results are quite different. In this test server was quite responsive with average page load time around 2.1 seconds even with 40+ simultaneous connection. And all this due to the technology behind nginx web server, written by Igor Sysoev.
Feel free to use LoadImpact for you server testing purposes as well, and test mine to see for yourself what nginx can do under high load.
I guess this answers the call – nginx won and my future setups will be based on it, unless there will be a _really_ heavy need for Apache. Oh and by the way, if you are afraid of using Linux based virtual private servers, Linode.COM makes it really easy with a nice resource library and a collection of StackScripts, which simplify your setup. As a matter of fact, i even created my own script and use it for all of my customer’s deployments.
Update: recently a client of mine (CompleteBody.COM) did a Groupon promotion. This resulted into a traffic spike from 150 regular daily visitors to their website into 7000 in one day. The Linode VPS (smallest size box configuration) handled it pretty well with CPU spike only of 20%. At the time of writing the website was a WordPress blog hosted on nginx + php-fpm with WP-Cache plugin. Graphs below (2hr averages provided).
Update2: I have decided to go even further and tested my Linode VPS with a 100-300 simultaneous users spike – read results here.