Cache Plugins

Cache Plugins

The Problem

Caches are important in WordPress and any content management system. They speed up delivery of static content by caching a page in memory or on disk so that the code necessary to generate the page does not have to be executed the next time it is retrieved. They can also speed up delivery, to a lesser extent, of dynamic content by caching database queries and page fragments.

Caches will also often add minify capabilities for HTML, CSS, and JavaScript which reduces the size of the data that has to be delivered. Some also add compression which can also reduce the size of the data to be transmitted. Since Google now includes speed as part of their page ranking in search results, fast delivery is important if you want your website to be seen.

I have found it to be a challenge to find a cache plugin for WordPress that actually works properly and provides enough flexibility. The problems I’ve run include an inability to disable compression. Our web server was configured to compress pages. If a plugin also does so it resulted in double compression which browsers don’t know how to deal with. I have disabled deflate by default on our web server to accommodate plugins in which compression can not be disabled. You can still enable web server compression using your .htaccess file.

Dynamic content must not be cached, otherwise web applications, which intentionally return different data, won’t function properly. Some plugins either lack the facility to exclude necessary pages, or their exclusion mechanism does not work. Some will break WordPress to the point where it becomes impossible to login without hand editing the wp-config.php file to manually disable them.

Many caches do not provide good performance because they don’t allow you to configure them to use some form of memory caching such as memcached or an in-memory file system for caching.

Caches and their Advantages and Disadvantages

Comet Cache
Comet Cache properly configured provides huge speed-ups. It has been the most trouble free of any cache plugin I’ve used. Usually it detects dynamic content and doesn’t tend to screw it up. The URI exclusion works properly so if it does not detect dynamic content on it’s own adding the specific URIs to this list will take care of it. Most effective caching happens if you put the cache directory in /tmp. To get it there you will need to take the path it already has and use ../../.. to back out of public_html, then your directory then home, and then add /tmp/user.unique where .user is you so yours does not clobber someone elses cache directory. For example, /../../../tmp/nanook.thoughts for one of my blogs. The reason putting it in /tmp helps is that this is an in memory file system that is far faster than disk.
Hyper Cache Extended
Hyper Cache Extended provides only a moderate speed-up. It does have an exclusion mechanism that works and compression can be disabled. Every once in a while it serves scrambled CSS code that Firefox can’t make sense of and renders the page bad. I used it initially because it was one of the few cache plugins that had a functional exclusion mechanism and compression control. But it’s much slower than WP Fastest Cache and less reliable.
Memcached Is Your Friend
This plugin isn’t a full page cache. It is an object cache and will speed up the rendering of dynamic content. If your site is only static content or infrequently changed content, then you don’t need this plug. But if you’ve got dynamic content, this plugin will help your page render faster while still retaining it’s dynamics.
W3 Total Cache
Full of features, full of bugs if used with certain themes, in particular it does not work well with Twenty Eleven but does work well with many others. What I liked about this plugin is it’s support for memcached. Nothing caches faster than memory. That would be all great if it worked, but for some reason, after a while, stuff cached in memcached would become corrupted and the page would be garbage. Restarting memcached or clearing the cache would restore functionality for a while. But eventually it would break again. In addition, if I enabled object caching, the page would be rendered as gibberish, and also had problems with it’s version of HTML minify. All in all, it’s very featured but the bugs make it unusable on this site which uses TwentyEleven theme.
This plugin is very fast and simple but it provides no mechanism for adjustment other than turning it on or off and an option to clear all cache when a new post or page is published. it does not provide any method for excluding dynamic pages from being cached or the home page from being cached. It will break many dynamic plugins. Ideal for a blog site or a site with no dynamic content because of it’s speed and simplicity. Not very useful for anything else.
WP Fastest Cache
On our platform, this cache plugin lives up to it’s word. It serves static content faster than any other plugin I’ve tested, including the big ones W3 Total Cache and WP Super Cache. It’s not as featured as it’s bigger brothers but it’s solid. It has provisions for page exclusions that work properly. It’s minify doesn’t seem to break anything. It is an excellent choice for any content hosted here and is the Cache I’ve ended up using for our site.
WP Super Cache
The biggest shortcoming of this plugin is that it lacks any way of excluding specific pages and not even the types exclusion functions. I ticked both the exclude home and exclude front page boxes and still it cached the home page. It even cached the login page which made it impossible for me to login without first editing the WordPress wp-config.php file to disable caching. Still it is the most widely used cache plugin out there.

Our Recommendations

For WordPress websites that are largely static, I recommend using WP Fastest Cache alone. For sites that have a lot of dynamic content, I recommend using WP Fastest Cache in conjunction with Memcached Is Your Friend object cache. If your theme works well with w3 Total Cache, that offers a lot of flexibility as well as performance but it does not get along well with some themes. Both of WP Fastest Cache and Memcached Is Your Friend plugins are solid and fast and reasonably light weight. With Firefox on a Comcast cable connection, this combination reduces rendering time of this page from around 550ms to 23ms, more than a 20x improvement.

Recent Posts