Speed up WordPress with the W3 Total Cache Plugin
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:
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 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” :
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 :
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.
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 :
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.