17

By January 6, 2011

In WordPress Plugins


Did you know you can significantly speed up any WordPress blog by adding a cache plugin ?

By default when a visitor views your WordPress blog, your web server makes calls to your site’s database and uses PHP to output the pages to the visitor’s browser. By adding a cache plugin, your blog’s pages are converted into plain html and stored, so a visitor downloads these html pages rather than interacting with the database. This significantly reduces page loading times and allows more traffic through your site.

I first found out about WordPress cache plugins out of neccesity, I used to run a blog that would regularly feature on the homepage of Digg, this would send huge amounts of traffic and my poor server couldn’t cope and would just crash. After adding a cache plugin it was able to handle the traffic, so thats another reason to use one – you can handle large spikes in traffic. I used to use the WP Super Cache plugin on all my sites but I am now moving over to W3 Total Cache as I want to start using a CDN:

CDN is a Content Delivery Network of highly-optimized servers all around the world working together to distribute your content (CSS and Javascript files, downloadable objects, applications, real-time media streams, and much more) through hundreds of servers instead of a single host. This “smart route” technology makes sure each visitor to your site gets their data from the city closest to them.

Description from Max CDN.

In this guide we will be looking at how to add the W3 Total Cache plugin to your site and how to configure it.

Download & Install the Plugin

You can dowload the plugin here, then upload it to your wp-content/plugins folder via ftp. You can download a free ftp client called Filezilla for this purpose.

You can also upload the plugin directly, via your wordpress admin panel by clicking Plugins > Add New > Upload > Install Now.

You will also need to enter your ftp settings there as well, your webhost will have provided these when you signed up.

Once the plugin is uploaded, visit your plugins page and click “activate” next to W3 Total Cache. You will now see a new menu in your admin sidebar called “Performance” :

General Settings

Choose “General Settings from the new “Performance” menu. Tick the first box under “General”, this will activate all the parts of the plugin :

The next section is “Page Cache”, this is the part that creates static html pages from your blog pages, ensure it is ticked :

Next up is “Minify”, what this does is remove unnecesary code from your CSS and Javascript files – a lot of times there will be comments and extra spacing in these files which is not needed so minify will remove this and can decrease these filesizes by up to 10%.

The next section is “Database Cache” again make sure this is enabled because this will speed up post and page creation times and your RSS feed as it caches the queries made to the database to create these.

“Object Cache”  This setting increases performance for highly dynamic sites (that use the Object Cache API).

The next section is “Content Delivery Network” as I mentioned before, I wont be using this at the moment but will do a future guide to setting this section up, so for now, leave this section unticked.

Lastly we have “Browser Cache”, this enables http compression and adds expiration headers to each visitor’s individual browsers. Tick this section.

Now that we have enabled the sections we want to use from the W3 Total Cache plugin, we will go into each one and check their individual settings.

Page Cache Settings

Choose “Page Cache” from your “Perfomance” menu and make sure the following items are ticked :

These are fairly self-explanatory, I like to make sure that the “Don’t Cache Pages for Logged in users” is ticked so that any changes you make to your blog while working on it are viewed immediately by the admin and you wont see the cached pages. You can always log out of the WordPress admin screen to check the speed of your blog.

The next section is “Advanced” you can leave these as defaults – they specify how long to keep the cached files on disk before renewing them, the default is 3600 seconds (5 minutes) you can increase this if you wish, if you do not have a particularly busy site. The other settings are, which files not to cache such as the admin panel etc.

The next part is “Cache Preload”, by default the plugin creates the cached html pages only when someone visits them – you can pre-load them if you wish by using this section. You blog will need an XML sitemap. You can add one of these by using the Google XML Sitemaps plugin (I recommend you do this anyway). You again set here how long to keep the cached pages before they expire, the default is 3600 seconds.

Minify Settings

The settings in this section will vary from site to site because most themes will use different combinations of CSS files and Javascript files. The easiest way to create the settings for Minify is to hit the “Help” wizard button at the top of the section. This will produce a popup window where you can tick which files you want to minify, then click “Apply and Close”

I use a lot of Javascript on WPLift so I chose not to minify it incase it causes any errors. I did choose to minify my CSS and used the following options :

Database Cache Settings

You can leave the settings in here as the defaults, if you have any important pages which rely on database queries you can add them to “Never Cache the following pages”

Object Cache Settings

Again, you can leave all settings in here as the defaults

Browser Cache Settings

I want to encourage browser caching if possible as this means that for people who visited your site before, their browser will pull images and CSS files from their browser cache rather than downloading from your hosting. This appears to speed your site up greatly, I used these settings :

Conclusion

Now you have setup most options for the W3 Total Cache plugin, logout of your site and have a browse around. You should notice  a significant speed increase. To double check that the cache plugin is working correctly, view the page source of your site and scroll to the bottom, you should see something like this added:

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user is logged in)
Database Caching using disk (user is logged in)
Object Caching 2236/2455 objects using disk

Served from: wplift.com @ 2011-01-06 10:56:24 -->

I will cover setting up WordPress with the CDN option in a future post. If you have any questions / comments please leave the below.

Oliver Dale is the founder of Kooc Media, a startup company based in the UK. Kooc Media builds Online Communities, Web Applications, WordPress Plugins and has been publishing content online for many years.

More Posts By


  • http://www.thewanderingbrit.com Dave

    I too used to use WP Super Cache, but switched to W3 Total Cache about three months ago because I was hearing such great things about it. I’m glad I gave it a go – it reduce my load time from 6-12s with WP Super Cache to under 2 seconds. I haven’t tried the CDN route yet, but that will be my next step once traffic gets to that next level. Great tutorial

  • http://wplift.com Oli Dale

    Cheers Dave.

    Your site is rapid! Interesting too – Added to my feed reader :)

  • wpmag.com – WordPress News, Themes, Tutorials, Plugins, Questions, …

    Speed up WordPress with the W3 Total Cache Plugin…

    » Speed up WordPress with the W3 Total Cache Plugin | WordPress Blog, Themes, Plugins & Tutorials…….

  • http://www.nebulasdesign.com Nebulas Website Design Essex

    Great post thank you this really works. I have signed up for email updates and am now following you on Twitter.

  • http://wplift.com Oli Dale

    Cool, thanks :)

  • http://wplift.com/using-w3-total-cache-plugin-with-a-cdn Using W3 Total Cache plugin with a CDN

    [...] other day I showed you how to install the W3 Total Cache plugin to speed up your WordPress sites, I covered all the main settings apart from CDN. To recap : CDN is a Content Delivery Network of [...]

  • Novayp

    Great Info, I can speed up my page 4x faster than before. Thx

  • http://wplift.com Oli Dale

    Glad it worked for you!

  • http://twitter.com/hankjouh septa
  • http://bathroom-kitchen-faucets.com/ Donald Shane

    Thank you very much for such informative article. I have successfully configured my blog.

    Best regards,
    Donald

  • http://internettvdotcom.com Phil (InternetTvDotCom)

    The W3TC is a nice plugin and does make my blog run faster. Unfortunately, I keep experiencing database crashes and can’t repair it from the plugin. I have to go to phpMyAdmin area in my hosting account to repair the database, specifically _wrdp15 (93) >> wp_posts (where it contains all my posts and pages).

  • http://wpmu.org/speeding-up-your-wordpress-website-11-ways-to-improve-your-load-time/ Speeding Up Your WordPress Website: 11 Ways to Improve Your Load Time | WordPress News at WPMU.org

    [...] Olly from WPLift has got an indepth walkthrough on setting up the W3 Total Cache Plugin [...]

  • http://iteworld.org/2011/speeding-up-your-wordpress-website-11-ways-to-improve-your-load-time/ SFCite | Blog | Speeding Up Your WordPress Website: 11 Ways to Improve Your Load Time

    [...] Olly from WPLift has got an indepth walkthrough on setting up the W3 Total Cache Plugin [...]

  • http://robertkeenan.wedalertnetwork.com/labs/syndication/rss/speeding-up-your-wordpress-website-11-ways-to-improve-your-load-time/ Speeding Up Your WordPress Website: 11 Ways to Improve Your Load Time

    [...] Olly from WPLift has got an indepth walkthrough on setting up the W3 Total Cache Plugin [...]

  • http://www.techadi.com Adii

    Informative article for configuring W3 caching….!! it doubled the site loading!! Thanks :)

  • http://www.webuildyourblog.com/ Andrew Rondeau

    Oliver

    I’ve been using W3-Total-Cahe and a CDN for a few weeks now and have seen a vast improvement.

    In your post you mention, enabling “Database Caching” and “object caching”. Am I right in saying they only benefit the speed if you have a dedicated host server?

    I don;t have a dedicated server and don;t have them enabled.

    Thanks.

    Andrew

  • Chris Lawhorn

    This is a great tutorial.  One question though, that’s got me stumped.

    In the minify CSS section of the plug-in, I’ve added the file URIs for my site:

    Example:  http://www.fakesite.com/wp-content/themes/faketheme/superfish.css

    When I test it using the “Verify URI” it pulls up fine.  But it doesn’t actually work when minified.

    What’s strange, though, is that I can list an identical file from the CDN:

    Example:  http://www.cdn.fakesite.com/wp-content/themes/faketheme/superfish.css

    And this works fine–both when I verify it and when I enable minification.

    Any idea why the CDN version works but the hosted version won’t?  Even when the actual file served by both is identical?

  • http://iteworld.org/2011/101-essential-free-wordpress-resources-for-building-your-wordpress-website/ SFCite | Blog | 101 Essential Free WordPress Resources for Building Your WordPress Website

    [...] Speed Up WordPress with W3 Total Cache – great setup guide from WP Lift for setting up the massive W3 Total Cache [...]

  • http://wpmu.org/101-essential-free-wordpress-resources-for-building-your-wordpress-website/ 101 Essential Free WordPress Resources for Building Your WordPress Website | WordPress News at WPMU.org

    [...] Speed Up WordPress with W3 Total Cache – great setup guide from WP Lift for setting up the massive W3 Total Cache [...]

  • http://wp.xn-----vlck7a.xn--p1ai/2011/06/09/osnovnyie-besplatnyie-resursyi-dlya-sozdaniya-vashego-sayta-na-wordpress/ Основные бесплатные ресурсы для создания вашего сайта на WordPress | Создание сайтов на WordPress

    [...] Speed Up WordPress with W3 Total Cache – great setup guide from WP Lift for setting up the massive W3 Total Cache [...]

  • http://wplift.com/10-things-you-can-do-today-to-improve-your-wordpress-blog 10 things You can do Today to Improve Your WordPress blog

    [...] Install a caching plugin, check out our guide to the W3 Total Cache plugin [...]

  • http://www.techuelx.com sanjeev

    great post…this plugin came like a thing which changed my site performance alot

  • http://tightmixblog.com/25-extremely-useful-wordpress-plug-ins-for-musicians/ 25 Extremely Useful WordPress Plug-ins for Musicians | Tight Mix Blog

    [...] bit faster. It is quite a hefty plug-in and can be intimidating to set up, so I suggest you follow these instructions to make setup less of a [...]

  • http://www.doitwithwp.com Dave

    W3 Total Cache is one of the first plugins I install on any site. Significant speed improvements and lower bandwidth costs make it a no-brainer. And much easier to configure than the previous best caching plugin, WP Super Cache

  • Anonymous

    I have been reading a lot about these caching plugins and they sound great, but wouldn’t they screw up an e-commerce site?
    I have hardly any static pages on my shopping site.  Most of my pages show categories of items, shopping carts, search results, etc.
    How much benefit do you think an e-commerce site would get from caching?

  • dusty johnson

    Thanks for the supermen leather jackets tips, I am going to apply these tips and I’m glad I found this blog because I had no idea about this before smallville leather jacket

  • http://wplift.com/auto-link-words-on-your-wordpress-site-to-affiliate-products Auto-Link Words on your WordPress site to Affiliate Products

    [...] maximum of 3 links per post etc. Hit save and then remember to clear your cache if you are using a cache plugin and go check some posts to make sure your keywords are linked [...]

  • http://newsletter.wp-coder.net/2011/10/auto-link-words-on-your-wordpress-site-to-affiliate-products/ A Free wordpress newsletter » Auto-Link Words on your WordPress site to Affiliate Products

    [...] maximum of 3 links per post etc. Hit save and then remember to clear your cache if you are using a cache plugin and go check some posts to make sure your keywords are linked [...]

  • http://www.wp-coder.net/auto-link-words-on-your-wordpress-site-to-affiliate-products/ wp-coder.net » Auto-Link Words on your WordPress site to Affiliate Products

    [...] maximum of 3 links per post etc. Hit save and then remember to clear your cache if you are using a cache plugin and go check some posts to make sure your keywords are linked [...]

  • http://www.customizewordpressblog.com/auto-link-words-on-your-wordpress-site-to-affiliate-products/ Auto-Link Words on your WordPress site to Affiliate Products | Customize WordPress Blog

    [...] maximum of 3 links per post etc. Hit save and then remember to clear your cache if you are using a cache plugin and go check some posts to make sure your keywords are linked [...]

  • http://staceymyers.com/3-ways-to-increase-site-load-time 3 Ways to Increase Site Load Time

    [...]  Similarly, WP Lift has a post to take you through the setup of W3 Total Cache. [...]

  • http://blog.asmallorange.com/3-tools-to-speed-up-your-wordpress-site/ 3 Tools to Speed Up your WordPress Site | Web Hosting Blog at ASO

    [...] This second tutorial, from WP Lift, goes step by step in helping you optimize a W3 Total Cache plugin to its maximum potential. The tutorial shows you how to do this by going through every settings page for the W3 Total Cache and makes suggestions along the way for producing the a functioning and fast site. [...]

  • http://www.ajgraves.com/ Aaron Graves

    I recently started using W3 Total Cache, and browsing my site is now “nearly instantaneous.”

    I’m looking at deploying the CDN option, and am curious if anyone is using Amazon S3/Cloudfront to do so? Seems to be the most cost efficient way to go for me.