Optimizing Your WordPress Site

Filed in Cloud Industry Insights by Chad Keck | February 16, 2010 11:05 am

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[1] platform which is one of the most popular open-source web applications in existence.

In the WordPress[1] 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[2]) 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+ POPs 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[3] 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!

Learn more about how Rackspace can help you with hosting your WordPress site[4].

Endnotes:
  1. WordPress: http://wordpress.org
  2. Paul Kehrer: http://langui.sh/
  3. developer: http://langui.sh/
  4. hosting your WordPress site: http://www.rackspace.com/cloud/sites/web-hosting/wordpress/

Source URL: http://www.rackspace.com/blog/optimizing-your-wordpress-site/