Optimizing Your WordPress Site

My colleague wrote an excellent article the other week on making your web sites load faster by leveraging the Rackspace Cloud Files & CDN platform to serve all static content on your site. I want to take this a step further for those of you who leverage the WordPress platform which is one of the most popular open-source web applications in existence.

In the WordPress community there are countless plugins that can be used for optimization, so how do you know which ones to use? Well I’m about to tell you and save you many hours or days of searching and experimenting.

The first plugin I want to mention is already one of the most popular – WordPress Super Cache. This tool generates static HTML files from your dynamic pages produced by WP. Once the HTML version of the page is generated your hosting platform will serve this in place of the dynamic PHP pages which causes increased server load and longer page load times. The vast majority of your visitors will be served static content by default but WP Super Cache knows to switch back to the standard PHP pages for users who are leaving comments (or have left a comment), users that are logged in, and users who are reading a password protected blog post.

What does this do for you exactly? There are two significant benefits:

  1. Reduced server resource utilization: Having your web server serve static content instead of dynamic content decreases CPU and memory utilization significantly and result in smaller hardware/resource requirements or allow your current hardware to handle many more concurrent connections to your site(s). On platforms such as Cloud Sites from the Rackspace Cloud this will have a large impact on your compute cycle usage.
  2. Decreased page load times: Decreasing page load times makes for a better end-user experience on your web site and is shown to reduce bounce and improve overall stickiness on your pages.

Installation

  1. Download WP Super Cache here
  2. Upload to your WordPress /wp-content/plugins/ directory
  3. Modify the /wp-content/wp-cache-config.php file: Uncomment “$use_flock = true;” (if using Rackspace Cloud Sites)
  4. Login to your WordPress admin console and navigate to ‘Plugins’
  5. Activate the WP Super Cache plugin
  6. Before turning on WP Super Cache you MUST enable permalinks (Settings –> Permalinks)
  7. Navigate to Settings –> WP Super Cache
  8. Set WP Super Cache status to ‘On’
  9. Make sure that “Super Cache Compression” is set to “Disabled”
  10. Leave all other options default unless you know specifically how this will affect your site
  11. Click ‘Update Status’
  12. Scroll down and copy the updated mod_rewrite rules
  13. Paste these new rules into the .htaccess file within your WordPress root directory
  14. Depending on how your permissions are set there is a button you can click which may be able to do this automatically for you
  15. Done!
  16. To verify that WP Super Cache is working properly visit your site directly (you may need to logout depending on your settings. Pull up a page/post and use your web browsers ‘View Source’ feature. Scroll to the bottom of the page and you should be something like this:
<!-- Dynamic page generated in 0.380 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-02-16 17:36:22 -->
<!-- super cache -->

You are all set and now your WordPress site can handle much more traffic and operate much more efficiently.

The next plugin I want to talk about also has a big impact on site performance and can further reduce server load. CDN Tools (developed by Paul Kehrer) is a plugin that allows you to load your sites javascript and media files to an external CDN platform such as Cloud Files from the Rackspace Cloud. Even if you don’t have or want to use the Cloud Files storage and CDN platform you can load your larger JS libraries (prototype and jquery) for free from Google’s servers.

If you are not familiar with platforms such as Cloud Files, what this allows for is global distribution of your static media files (images, video, documents, etc) over a Content Delivery Network or CDN. Cloud Files offers seamless integration with Limelight Network’s CDN platform that is the second largest in the world allowing your static data to be distributed across 50+ nodes around the globe. When a user from a specific geographic location requests one of the files you have cached on Limelight’s CDN, they are served this data from the closest possible data center to them, vastly reducing network latency which is critical for a global audience. Serving data from a single US data center may work great for a mainly North American audience, but when it comes to sending large files across the ocean, that is a different story entirely.

Some might ask why you would want to pay an additional cost to use a platform such as Cloud Files and this really just depends on your needs. If you have a small family blog it may not be necessary, but if you are running a popular site with a lot of static media typically the reduction in CPU/memory from your server or platform having to load this static content anyways more than makes up for the low CDN cost of $0.22/GB and the benefit of a much better end-user experience.

Installation

Installing CDN Tools is incredibility simple and only requires a few clicks after uploading.

  1. Download CDN Tools here
  2. Upload to your WordPress /wp-content/plugins/ directory
  3. Login to your WordPress admin console and navigate to ‘Plugins’
  4. Activate the CDN Tools plugin
  5. Navigate to Settings –> CDN Tools
  6. Enable ‘Use Google AJAX CDN’
  7. If you have a Cloud Files account choose Cloud Files from the ‘Primary CDN’ drop down menu
  8. Enter your Rackspace Cloud control panel username and account API key (located in the control panel at ‘Your Account à API Access’
  9. Save Changes
  10. Click ‘Load Files’ (this side loads all your static data to Cloud Files and moving forward it will do it automatically)
  11. Done!

Note: The developer for CDN Tools has carefully crafted this plugin allowing you to easily disable. If you ever need to turn off CDN Tools it will automatically update your file paths without you having to do anything manually. This is a big plus!

  • Pingback: Wordpress Hosting » Blog Archive » Optimizing Your Wordpress Site | Chad Keck DOT Com()

  • Tom

    Very useful, I love these kind of things. Makes me feel like I can have the best setup without the know how. Look forward to more articles on how to make my site run the best.

  • http://alegua.com.ar Sandro Franchi

    A question Chad, do you know of an equivalent to this pluging but for “non CMS” sites, I mean, a custom developed website? I’m using this plugin all the time and would like to add this same features to http://mixuna.com.ar, one of our sites.

    Thanks!

  • brian

    hi, i tried the steps in this post exactly using cloudfiles/cdn tools/supercache and not will upload to cloudfiles giving error saying “”A file failed to upload. CDN Tools will behave inconsistently if all files do not upload successfully! You should contact the developer with this info:
    Could not open file for reading: /2010/03/1269308257.jpg”

    it gives that error right away when i click to upload withing CDN tools…the folder permissions for /content/uploads and images are all correctly configured…..i trued this on 3 different servers/hosts…..all same error…. too bad since i dont really have a use for cloudfiles without the ability to upload automatically via this plugin….any suggestions would be great as the plugin isnt really supported

    • http://www.chadkeck.com Chad

      Brian,

      Thanks for the feedback here, let me check with the developer and see if there are any known issues with the latest version. I just did an install on a clean WP site and didn’t see any errors nor am I experiencing any here, but you never know.

      Hopefully if it is a bug on the plugin the developer can get it fixed in short order.

  • http://imaginarytrout.com Imaginary Trout

    Rackspace Cloud Servers + NGINX + PHP-FPM + MEMCACHED + W3-TOTAL-CACHE = HOMERUN

    • http://www.chadkeck.com Chad

      That is a pretty kick-butt setup there!

  • http://langui.sh Paul Kehrer

    Hi Brian, I’m the developer of CDN Tools. Could you give me a bit more detail on your issue? Are these blogs you’ve migrated from another server? Typically this issue arises when the actual absolute file path on the server differs from what WP holds in its database. You can email me at paul dot L dot kehrer at gmail if you want to try to get this resolved.

  • Pingback: I’m Reselling Rackspace Cloud Sites()

%d bloggers like this: