The subject of the W3 Total Cache plugin has been popping up more and more often in questions from our users of late and we’ve decided to devote some blog posts to covering the basics of this popular and powerful caching solution.
In this second part of our overview series, we’re touching on some of the more advanced options available for its setup.
If you’re coming to this topic for the first time, we recommend starting with our initial article – The Total Beginner’s Guide to W3 Total Cache.
Due to the sheer number of potential server setups out there in the wild, out of necessity we will be sticking to an overview of some of these advanced options as we dive a little deeper, rather than getting into detailed configurations.
Let’s begin with a very brief recap of what was covered in the first article and draw attention to some useful wider resources.
Brief Recap of the Basics
Our introduction to W3 Total Cache covered the following areas:
- Background on caching in general and the plugin in particular.
- Options for installation.
- Basic page and browser caching options.
- An introductory look at minification.
- W3 Total Cache plugin homepage: The Installation and FAQ tabs here address many common issues users run into. Make sure you review them both carefully. You can also access the support forums from this page.
- W3 Edge FAQ: This set of FAQs provides a little more detail, including coverage of technical questions such as, for example, whether to choose opcode caching or memcached. It’s well worth a detailed read before you start integrating on your own site.
- Stack Exchange: As always, Stack Exchange and Stack Overflow are likely to be your friend at some stage.
Code bloat is an ongoing problem for many sites, and there are two main culprits when it comes to WordPress:
- CSS: The arrival of CSS frameworks has spared front-end developers a lot of heavy lifting at the expense of substantially increasing the average code base size in themes.
It’s well worth reviewing the Minification sub-section of the W3 Edge FAQ page before starting to explore all the options here.
As we suggested in the previous article, the first step is usually testing the default settings for minification to see what (if anything) breaks. Do this by going to Performance > General Settings > Minify. You’ll typically see the greatest savings here by selecting the disk caching method.
If you do find yourself needing to tweak, then you’ll need to switch the minify mode to manual to fine-tune each option directly from Performance > Minify.
The first thing to notice in the Performance > Minify options is that error reporting is available to help you track down the specifics of any problems you run into.
With the range of theme and plugin configurations that this module can potentially affect, controlled experimentation is very much the key.
Take advantage of the ability to test items individually and make sure to use the plugin’s import/export options to help document your decisions and dial in the setup that is right for you.
As we noted in the first article, WordPress is a database heavy application.
Many of the calls made will be exactly the same as the site uses, so it makes little sense to be hitting the database time and again if the results of a particular set of queries can be cached.
Database caching enables you to do just this while also being smart enough to know when the information behind the scenes has changed and needs to be served up anew.
Our suggestion is to test in isolation on your own setup to judge its effectiveness.
The types of performance gains on offer here will very much depend on the complexities of your own setup, with the main distinction being whether the information is stored on disk or in-memory with a solution such as APC or Memcached.
The common consensus seems to be that in-memory solutions provide the best results for the database cache.
You can select the database cache method in Performance > General Settings > Database Cache.
Further fine-tuning is then available in Performance > Database Cache.
The main option to pay attention to here is to make sure that Don’t cache queries for logged-in users is selected in order to ensure that normal WordPress functionality continues to work as expected.
The default values for Maximum lifetime of cache objects and Garbage collection interval should be adequate for most setups.
The Never cache the following pages box gives you a handy way of being able to exclude sections of a site if you run into compatibility difficulties with a particular plugin or part of your site.
WordPress ships with a number of object caching options built in for developers to access and make use of.
The general theory here is similar to that of database caching: information associated with WordPress operations can be stored and reused quickly without having to be constantly regenerated.
The first point to notice here is that this is likely to do more harm than good if you find yourself on shared hosting, so unless you are managing your own server setup it is best to ignore this option.
The option can be enabled by going to Performance > General Settings > Object Cache and selecting the Object cache method of your choice.
As with the previous database option, in-memory storage is likely to yield better results here if you have it available to you.
Further tweaking is available via Performance > Object Cache but the default settings here should be more than suitable for the average setup.
Content Delivery Networks
Using a CDN (Content Delivery Network) means offloading the delivery of a certain subset of your content to a company that specializes in getting that content to the user as quickly as possible, regardless of where they are in the world.
They do this by having numerous data centers located strategically around the globe where your content is mirrored and delivered to the user from the location nearest to them.
In terms of the backend of W3 Total Cache, there are three general areas to configure in Performance > CDN. Firstly, you need to decide which types of content you will be offloading to the CDN in the General options.
Secondly, you need to establish the connection with the CDN itself via the Configuration panel.
Options here will naturally vary from provider to provider but the good folks over at WPBeginner have an excellent breakdown of how to install MaxCDN with W3 Total Cache that should give you a good idea of the overall process.
The default Advanced settings should work out of the box on most setups, so begin there before starting to tweak.
W3 Total Cache in the Wild
The following links provide some more detailed breakdowns of real-world W3 Total Cache performance that you might find useful when digging deeper into how best to implement it on your own site:
We hope the points above will shed further light on some of the more advanced features of W3 Total Cache and help you make the most of it within the parameters of your own particular setup. Two takeaways:
- If you’re managing your own servers – virtual or dedicated – database and object caching both stand to bring major performance increases.
- Minification and using a Content Delivery Network are options available to all and should bring significant gains to both you and your users.
Is there a particular set of snags you run into again and again? Or a subset of the plugin’s functionality you’d like to see us explore in more detail? Get in touch in the comments below and let us know!