So… I’ve been reading a lot about nginx and how awesome it performs. It sounds magical!
My blog (running WordPress) hasn’t been running as fast as I (or Google) would like. The TTFB (time to first bite) is often > 500 ms which is slower than it should be. I thought this would be a great opportunity for nginx to prove itself and impress me!
Right now the live site that you are viewing is running on Windows Server 2008, PHP (of course), MySQL and WinCache. TTFB ~ 500 ms.
The Second Location
I set up another location on a totally different server – running Windows Server 2012, same version of PHP, MySQL, and still running WinCache. I took a backup of the MySQL database and restored it to the new server, and took a copy of all the site files and copied them over. Everything was left default (no additional specific performance tuning). Got it up and running nice and easily (setting up sites on Windows + IIS is so painless!) and started some tests. Guess what… TTFB right around 500 ms. That wasn’t a huge surprise but it at least told me that the issue wasn’t something specific to my Windows 2008 install / configuration.
The Third Location
Okay, so now I moved over to a Basic CentOS 6 configuration. I installed nginx, PHP, and MySQL. There were a lot more steps to get everything set up on Linux, but I’ve been through the routine a few times so it was just a matter of running all the right commands. Got the content copied over, got the MySQL database restored, and got ready for some testing. I’m thinking “I wonder how close to 100 ms it will be.” I run an external page speed test against it… wait eagerly for the results… and there they are! Huh? What? 600 ms? What the…!?!? OK. Maybe something’s wrong so I opened up Chrome developer tools and run some tests there to see what it thinks about the TTFB. Pretty close. Hmm…
Test Results Summary
So, using the Developer Tools I run some more timing tests on Windows Server 2008, Windows Server 2012, and CentOS/NGINX so that I can get some TTFB averages. When looking at averages the numbers of all three were REALLY close. Just as often as not, the NGINX site was slightly slower (by a minimal number of milliseconds). No clear winner on speed here. With everything being the same, I’ll stick with Windows. Call me crazy but I like Windows Server – always have and always will. I like Linux for certain situations too, but running WordPress has not made it onto that short list of preferred-Linux scenarios.
What Does it Mean?
Other than all three platforms running about the same in speed, which is a pretty interesting point in itself, what else do we know? Well, I’m going to say that the issue is with WordPress itself rather than the platform. To be more precise, and perhaps fair, I’ll say that it is either WordPress, MySQL, PHP, some WordPress plugin, or something in that part of the stack – it isn’t the operating system nor the web service that is causing the less-than-ideal TTFB.