This summer, I had the pleasure of helping Mr. Money Mustache migrate, optimize and performance test their site. Any fans of Mr. Money Mustache probably remember the days of slow page loads and timeouts when trying to navigate the site for their financial freedom advice fix. With the combined powers of Pantheon, Valet and Mr. Money Mustache we were able to turbocharge performance and provide vastly improved site stability.
Curious how? Read on, dear friends.
Migrations and Builds: The Pantheon Way
Pantheon’s infrastructure is known for high performance and excellent developer tools. We also have a pretty great support team here with a smaller dedicated team managing the onboarding process, wherein we work with contract clients to onboard developers and review site configurations and performance. Essentially, clients have a short-term dedicated support rep to make sure the migration or build is smooth, dev tools are accessible, platform considerations are known, best configurations are in place and that the site is performant at scale. Site launches should be a time of celebration and success, not stress and teeth-gnashing.
Why Bother with Site Onboarding?
Sites are like houses: lots of effort for the initial construction, considerations for the environment underneath and ongoing maintenance that is sometimes ignored (resulting in detrimental impact over time). As an Enterprise Onboarding Manager at Pantheon, I see lots of common issues with migrations that we address during onboarding:
Drag and drop migrations don’t work too well across fundamentally different infrastructures. There will always be at least a few tweaks needed to code or configurations to leverage the power of Pantheon.
Plugins/Modules stop being maintained/create conflicts. In the open source world, you must be vigilant about monitoring the health and dependencies/conflicts of contributed code. Best practice is to review open issues and carefully review the readme.txt file.
Functionality testing is great, but the picture is incomplete without performance testing. What we should know about any site: what happens to functionality at scale? The best way to find out is to run a load test with virtual users, a sort of dress rehearsal for the site.
Mr. Money Mustache Migration: The Nitty Gritty
When Mr. Money Mustache attempted the initial import to try out Pantheon and move away from their virtual machine setup, there were a few immediate issues that needed attention:
Large sites need to use rsync/SFTP. When sites are moderately sized, it’s easy to run a quick migration through our importer tool, but the larger ones need to leverage rsync or SFTP with the command line.
Removing unnecessary caching plugins. All Pantheon sites use our custom edge cache layer, so plugins like W3 Total Cache need to be uninstalled.
Creating symlinks for files. A plugin called Zel-Tabbed Widget was writing to a location that we lock down via version control, so we needed to symlink to our highly available filesystem in order to function.
Once the import was up and running, we found a few pages were crashing consistently from a yet-to-be-identified cause. Discovering the root cause and implementing a fix meant digging into the code, and we knew just who to ask: our talented friends and beloved partners at Valet.
After a few hours of discovery they found two main issues resulting in page crashes:
WP125 plugin crashing PHP-FPM. Logs indicated that Nginx (which we use instead of Apache) was giving up on PHP-FPM processes, so Valet created a small plugin to replace this functionality.
The ZEL Tabbed Widget uses Timthumb, which needs special configurations to work with Nginx. They swapped this out with a plugin called WP Tab Widget.
Learn more about the work Valet did on the Mr. Money Mustache site in this screencast.
The Dress Rehearsal: Testing Performance
Now that functionality was in place we were ready to take it for a test drive on Pantheon. The result? Vastly improved page load times, especially as the edge cache started to warm up and no crashing as the number of concurrent users ramped up.
Soon after, Mr. Money Mustache made the blog cutover and not a moment too soon; the legacy hosting service was down again! While the forums still remain on legacy hosting at the time this went to press, the blog is humming along over here at Pantheon.
Happily Ever After on Pantheon
Websites are not static entities so web developers and site owners should always keep long-term maintenance in mind, not just the initial build. Annual or, even better, quarterly site reviews are essential in keeping your site happy and healthy over the long haul. Combine this with testing performance for each functional iteration and you’re well on your way to best practices and continuous integration. For the Mr. Money Mustache main blog we were able to discover issues, implement solutions and make sure functionality would scale. The end result? Happy Mustachians, a stable site and cheers all around.: WordPress, WordPress Hosting