Moving at the Speed of Creativity by Wesley Fryer

WordPress Site Caching with Amazon S3 & CloudFront

If you use WordPress as a content management system (CMS) on your website, it can be helpful to install a “caching” plugin which serves saved/cached webpages to visitors instead of making dynamic requests to the mySQL database connected to your site every time a page is visited. Once you’ve published a page or updated it, a “cached” copy is made which is served more quickly to web visitors. This speeds up your site’s performance. In this post, I’ll describe how and why I’ve switched from using the WP Super Cache plugin to W3 Total Cache. Both are free to install and use, but Amazon S3 and Amazon Cloudfront ARE commercial services used by W3 Total Cache. I’m expecting to pay less than a dollar a month for this installation, based on Steven Campbell’s explanation.

Button a Day Project: WordPress
Creative Commons License photo credit: cletch

Kyle Robinson Young defines and describes “caching” on a WordPress site by writing:

Each time you visit your blog, WordPress will go through a sometimes lengthy process to build everything you see. First it will process the PHP code which will make numerous calls to your database and finally output HTML for your web browser to display. On some blogs this could happen between 20 to 200 times per page! WordPress has often been criticized as slow but we can change that by enabling caching.
If you enable caching only the first visitor will go through this entire process. The caching mechanism will save the data and then serve every subsequent visitor the final result. Thus speeding up WordPress by a huge factor. Trust me, you want it and your visitors will thank you for using it.

On the recommendation of James Deaton, I installed and configured the W3 Total Cache plugin for my WordPress blog recently. W3 Total Cache is described as:

The fastest and most complete WordPress performance optimization plugin. Trusted by many popular sites like: mashable.com, smashingmagazine.com, makeuseof.com, kiss925.com, pearsonified.com, lockergnome.com, tutsplus.com, johnchow.com, ilovetypography.com, webdesignerdepot.com, css-tricks.com, yoast.com and others — W3 Total Cache improves the user experience of your site by improving your server performance, caching every aspect of your site, reducing the download times and providing transparent content delivery network (CDN) integration.

I used Steven Campbell’s clear and thorough instructions to get everything configured. I already had an account with Amazon S3, so the activation of Amazon Cloudfront was speedy. If you don’t have an existing account, you’ll need to create one with a credit card to complete these steps. Basically, this setup lets the majority of the media files on your blog download from Amazon’s servers instead of your own server. After getting everything configured, the plugin uploads your existing files to your Amazon S3 “bucket,” and then does the magic so your site pulls content from Amazon instead of serving it locally.

Media Library export - W3 Total Cache

A couple of weeks ago I started having problems with my installation of the WP Super Cache plugin. Since then, I’ve been running without a caching solution. My site has seemed to still be pretty responsive, but at times I HAVE encountered some “page not available” and timeout errors. I’m not sure if these can and will be remedied now that I have W3 Total Cache installed, but I hope so.

After going through Steven’s setup instructions, the one additional tweak I had to do was follow these nimopress instructions for optimizing WP Total Cache with WPTouch. WPTouch is a free WordPress plugin I use to optimize my site’s display on mobile devices, including iOS devices like the iPhone and iPod Touch. Before adding the list of “user agents” described in that post to several configuration page settings of WP Total Cache, my site didn’t display properly on my iPhone. Now it looks fine. Hopefully that’s the case for other mobile browsers as well!

I have a complete list of my active and inactive WordPress plugins listed on my blog about page, thanks to WP-PluginsUsed.

Are you using W3 Total Cache or another WordPress caching solution? I’d love to hear about your experiences and recommendations. Setups like this are REALLY geeky and get close to maximizing my daily geek instruction following quota, but the payoff in terms of site performance seems to justify the hassle.

One thing I’m unsure about is how this configuration will affect accessibility to my website in schools and countries (like China) where strict content filtering is enforced. If Amazon S3 is blocked in a location, I’m thinking the media from my website will now also be blocked. If you can confirm or test this I’d be interested to hear your feedback as well. Of course we need to advocate for more balanced Internet content filtering, but no one is likely to make BIG changes in this landscape anytime soon… In our U.S. schools or in foreign countries which also love Internet censorship.

Technorati Tags:
, , , , , , , , ,

If you enjoyed this post and found it useful, subscribe to Wes’ free newsletter. Check out Wes’ video tutorial library, “Playing with Media.” Information about more ways to learn with Dr. Wesley Fryer are available on wesfryer.com/after.

On this day..


Posted

in

, ,

by

Tags: