Moving from Apache to Nginx – wow!

I have been meaning to switch this site from Apache to Nginx for a while now – actually, to tune this website a bit better as a whole. I’ve been using various tools (Google PageSpeed, http://www.monitor.us, http://www.pingdom.com) to track the results and I thought I would recap how things have gone.

When I first started this project, I had a plain vanilla WordPress with no optimization running a handful of plugins on an old Dell 1U Solaris server using Apache+mod_php. PageSpeed showed my initial score to be 75. An infrequent monitor.us performance monitoring was telling me the average response time was about 650ms as a baseline.

My first step was to resize all the “system” images (NOT the gallery images). This bumped the PageSpeed score up to 77.

I tried installing W3 Total Cache, but the whole install was a mess. It wants to run to /wp-content, requests 777 permissions, etc. I had problems with the page display getting messed up, even after clearing the cache. Even though the pages were messed up, the PageSpeed score went to 81. I’m sure I could have figured how to actually get it up and running the way I wanted, but I wanted to do all this by hand anyway, so I scrapped Total Cache and moved on – back to Page Speed score 77.

Next up – enabling mod_gzip on Apache. PageSpeed score increased to 81 – not bad for a simple modification.

I was going to try and install mod_pagespeed from Google, but I had no luck getting it to compile with gcc under Solaris. I love Solaris, but I swear I need to switch to Linux one of these days. None of the new software compiles under Solaris. My list of stuff I can’t get to compile is long: mongodb, mcrypt, mysql-5.5.x, newrelic – and those are just the relics sitting in my /usr/local/src directory that I haven’t deleted in frustration.

Next I installed some object caching via APC, but the PageSpeed score stayed at 81. Adding sendfile and MMAP via the Apache httpd.conf bumped it up to 83.
It was at this point that I started a trial of Pingdom to track the page response times on a more granular level. However, Pingdom was showing page response times of around 975ms, which surprised me since monitor.us showed a drop from 650ms to around 587ms. I wish now I had a baseline number from Pingdom before starting any of this, but oh well.
Next up was the big change – moving from Apache to Nginx+php-fpm. After getting everything configured and tested, I switched. WOW! PageSpeed reports 94, and Pingdom reports response time dropping from 975ms to 237ms (see graphic). Talk about immediate results!
There’s more tuning I plan on doing (like implementing a CDN via S3), though I think all the big gains have been achieved. I’ll update the blog as I get the results.

Learning the Genesis framework

I’ve worked with the backend of WordPress before, writing plugins and such but often times just “hacking the guts” and forcing WordPress to do what I want, instead of doing it the “right” way, which is what I’m trying to do now.  But now I’m focused on how to do things like creating custom page templates instead of modifying existing templates, load external CSS properly, etc.

And I’ve never been much of a front end guy (i.e. UI/UX, graphics, layout, etc) so I never really bothered to learn CSS – I’ve still always done things in HTML3 with tables and <font> settings which, to be honest with you, is embarrassing.  Actually, I could read CSS but I didn’t have much experience in implementing it myself.  However, in learning JavaScript and jQuery, I’m obviously forced to get up-to-speed rather quickly on CSS.

So really this project is about learning CSS, learning the right way to do things in WordPress, and learning the Genesis framework – all quite a bit to handle at once.  I’m not sure if it’s easier to know how to do things in WordPress and learning how to do them in Genesis, or if it’s best to just learn how to do it in Genesis and not understand how it’s done (or if it’s even possible) in WordPress.

Frankly, it’s pretty easy though.. I want to implement a feature – I have an idea what I need to do, a quick Google search points me in the right direction and it turns out to be trivially simple!