Support: 1-800-961-4454
1-800-961-2888

Optimizing Your WordPress Site

25

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+ 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 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.

About the Author

This is a post written and contributed by Chad Keck.


More
  • David Folger

    Chad don’t you mean 50+ POPs around the globe? Since usually nodes refer to either a server or group of servers, and Limelight from last I saw has approximately 20,000 servers globally.

    • http://chadkeck.com Chad

      David,

      I sure did, thanks for pointing that out :) Fixed

  • http://www.jonahcoyote.com Jonah

    Good tips, here are a couple others:

    1. Checkout: – this plugin has a lot of potential but I haven’t done a lot of testing with it.

    2. http://farhadi.ir/works/smartoptimizer – I’ve used this successfully on a number of sites but there are some conflict issues with certain plugins.

    3. http://wordpress.org/extend/plugins/wp-smushit/

    Anyone have any .htaccess directive mods that can be used in the cloud?

    - Jonah

  • http://jeremybarnish.com Jeremy

    Another great article. Keep these articles on wordpress coming i have implemented things from each one on caching and cdn.

    Before this i didnt understand how to use cdn in a practical way on the 20-30 sites that i own … now i do. This kind of article is vital to getting your non technical users using all your great features.

  • http://www.GCCinvestor.com Jeff Pinkham

    Thanks for the tip.
    I’ve installed the pluggin but I’m stuck on step 13, I cannot find a .htaccess file in the root directory of
    http://www.gccinvestor/blog
    What can I do now?
    Jeff

    • http://www.globalhemp.com/ Global Hemp

      You may not have an .htaccess file. They are not standard and are only used to fix-up things, such as creating redirects, etc.

      To create one, you may need to name it htaccess.txt on your computer, such as Mac OS X, then upload it to the directory via FTP, then rename it to .htaccess. Windows may or may not show the file as well, but the Mac by default will not show an .htaccess file.

  • http://www.globalhemp.com/ Global Hemp

    Another tip would be to leave on GZIP Compression, unless you know your host does not like it.

    So, what I ask is if Rackspace has any issues with GZIP compression for WordPress. We currently use WP Super Cache.

    • http://schram.net Scott Schram

      gzip compression increases server CPU usage (everything that goes into the cache has to be compressed) and decrease bandwidth.

      gzip would speed up the page for people with slow connections… think iPhone 3G. They still have to load up the images though, so there may not be much benefit.

  • http://www.lostateminor.com/ Zac

    We’re using both of these plugins on our Rackspace hosted site, http://www.lostateminor.com/

    The CDN has saved us money I believe, so I agree with the above comments about it. And for a massively image heavy site, we’ve also got some nice performance improvement from using Cloud files.

  • http://schram.net Scott Schram

    I’m going to have to try this, because the performance of the Rackspace CloudSites is substantially slower than my Slicehost server.

    On the sites I’ve moved from Slicehost, the response time for a WordPress page has jumped from an average of 600ms to an average of 1800ms to 2500ms.

    Running WP Cache can be a pain, for example, editing Widgets does not clear the cache, so you can end up confused about why your pages are not reflecting changes. I use the setting that clears the entire cache when you edit a page.

    Also, WP-Cache tends to lag major releases of WordPress.

  • http://schram.net Scott Schram

    I’ve only been on CloudSites for a week or two. In the last couple days, performance has improved for some reason, and is now closer to 1000ms range.

  • http://www.wobzy.com Mark

    Instead of Super Cache I’d recommend using W3 Total Cache an up and coming caching plugin for WP that kicks 4ss! Built in CDN support and the ability to use memcached or APC if the server supports, etc. I’m not affiliated with them I’m just a happy user.

    • http://schram.net Scott Schram

      I don’t think memcache will help you on CloudSites, because each server in the cluster would have to compute the page in order to cache it in memory. A caching system that writes out the files to disk would share that file with every server in the cluster.

      • http://www.wobzy.com Mark

        Thanks Scott, understood. W3 Total Cache has two types of disk based caching of course so it’s not a problem to switch. Bests, Mark

        • http://schram.net Scott Schram

          Mark, Thanks for mentioning this plugin, I didn’t know of it before.

  • michaelrnz

    I’m making use of a similar setup on my Cloud Server. As a sort of a test I installed PHP-FPM+nginx, combine this with WP+CDN Tools+Super Cache and woosh. All seems to run pretty damn speedy.

  • Sojolly

    re: WP Super Cache

    Regarding this line: Modify the /wp-content/wp-cache-config.php file: Uncomment “$use_flock = true;” (if using Rackspace Cloud Sites)

    Are you saying to leave this alone if using Rackspace Cloud SERVERS???

    Much thanks!! for the clarification….

    • http://www.chadkeck.com Chad Keck

      No, not on Cloud Servers, only on our Cloud Sites platform. Let me know if you have any other questions!

      • Joe M

        Why flock? Isn’t flock bad with PHP? Please give us some insight with respect to Cloud Sites.

  • http://www.cloudcomputingprofessionals.com Cloud Computing

    Thanks for the webpost, it is nice to see companies educating the public to help them better understand whats behind their site and the options available to them.

  • http://www.globalhemp.com/ Eric

    Re: WP Super Cache
    I’m getting the following error after uncommenting config and activating plugin:

    ====================================================
    Warning! wp-cron.php not found!

    Unfortunately WordPress cannot find the file wp-cron.php. This script is required for the the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.

    Please see entry 16 in the Troubleshooting section of the readme.txt

    http://wordpress.org/extend/plugins/wp-super-cache/faq/
    ====================================================

  • http://nelwel.com Danny Nelson

    Thanks for this info. This configuration is working great for me. I’m not using the CDN feature as extensively as Super Cache, but is working well where I am using it.

    Here’s my nitpicking observation: you’re using the wrong WordPress logo for your post image. See http://wordpress.org/about/logos/

  • Peter Vijeh

    The recommended plugin ” CDN tools” is extremely out of date (compatible with wordpress 3.0, i believe) Are there any current instructions for how to set up a site with cloud files?

    • ruth.boulet

      I’m also wondering about the age of this plugin.

  • http://www.areuconnected.com/ Jabed Shoeb

    This instructions are outdated as CDN Tools is no longer compatible with latest WP 3.8. Couldnt fine any other plugin which can smoothly work with WP Super Cache. In this scenario, I think W3TC plugin is the best as this plugin has file upload/import option from wp to cloudfiles.

Racker Powered
©2014 Rackspace, US Inc.