Best WordPress Cache Plugin: WP-FFPC

Are you already using a WordPress Cache Plugin? I’ve tried many WordPress caching plugins on 100′s of blogs over the years and after much testing, I’m able to narrow down the options to what I think are the best 5 WordPress Cache Plugins.

…and the Best WordPress Cache Plugin is!

Ok, ok, so the title of this article already gave that answer away. However, if you are interested in the details of how I arrived at that conclusion I would be honored if you read on.

The issue with most Wordpress Cache plugins is that they store cache to disk and/or use .htaccess mod_rewrite. Both of which should be avoided for best performance. Even if you move .htaccess rules into Apache you must also disable AllowOverride (AllowOverride None) as per Apache docs:

“When AllowOverride is set to allow the use of .htaccess files, httpd [Apache] will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not you actually even use them! Also, the .htaccess file is loaded every time a document is requested.”

With that in mind, here’s my breakdown of the best WordPress cache plugins available and a brief overview as it relates to their performance.

#5 W3 Total Cache

(Download size: 1.87 megabytes)

This plugin can be fast. The operative word being “can” because with some setups it’s not. There are just so many ways to misconfigure this plugin. Please don’t read too much into that statement yet. I’ve had blog owners complain to me that W3 Total Cache “made their blog slower”. To troubleshoot, I used curl to test and many times that confirmed W3 Total Cache as the issue. BUT, this only happens when the plugin is misconfigured. For example blog owners that go crazy enabling all features to disk. Just head over to Google and start typing: w3 total cache sl  …you’ll see what pops up first. :) Also, once you begin to load up all those features notice how fast the .htaccess file grows. You should really move all the .htaccess rules into Apache’s config. Due to this, I would say W3 Total Cache isn’t for the average user, but it’s obvious that with around 4 million downloads it’s being used by just about everyone.

Pros:
– Allows for storage to Memcached, Xcache or APC (memory).
– Many performance options beyond caching. (be careful)

Cons:
– Relies on .htaccess for most features to work.
– Feels bloated, especially if you have server root access and only need WordPress caching.

#4 WP Super Cache

(Download size: 0.83 megabytes)

Allows the use of PHP for caching instead of .htaccess, however like others it stores cache to disk. Its interesting that WP Super Cache has been downloaded one million more times than W3 Total Cache, yet it has HALF the number of WordPress Plugin support threads. Yes, it’s a lot harder misconfigure and will be faster than default WordPress no matter the setup you choose. If you are going to use mod_rewrite then make sure to move all the .htaccess lines into Apache’s config AND disable AllowOveride. Otherwise, I recommend to stick with PHP instead. Also it’s important to remember that WP Super Cache was first released over 6 years ago when PHP 5.2 and PHP 5.1 were the most popular versions of PHP… Yikes!! Since then, with each new version, PHP has significantly improved in performance and the use of opcode caching has also grown in popularity. This is another reason why I recommend using PHP over mod_rewrite via .htaccess.

Pros:
– Easy enough to setup.
– Can be used without .htaccess by selecting to cache using PHP.

Cons:
– No option to save cache to memory.
– The verbiage of options and some suggestions are a bit dated.

#3 Hyper Cache

(Download size: 0.08 megabytes)

This was for a long time my go-to WordPress Cache Plugin. Uses PHP and saves to disk. Probably due to it’s minimalist setup, it serves cache faster than the above two plugins.

Pros:
– Always fast!
– Super easy to setup.
– No mod_rewrite .htaccess to mess with.

Cons:
– No option to save cache to memory.

#2 Lite Cache

(Download size: 0.02 megabytes)

Lite cache was also created by Hyper Cache developer Stefano Lissa. It’s very similar with a smaller feature set and slightly faster. This plugin also allows you to set the location where you’d like to save cached files. On many servers you can simply set this to /dev/shm and just like that you are saving and serving files from memory. With /dev/shm if you have sufficient free RAM the files will live in kernel cache. This is a Linux specific feature and any server with glibc 2.2 or newer will have/dev/shm available. You can use df to see if your sever has /dev/shm

Pros:
– Even faster!
– Super easy to setup.
– Allows easy caching to memory. (By changing the “path” setting to /dev/shm)

Cons:
– Lite on features

#1 WP-FFPC

(Download size 0.04 megabytes)

Developed by Peter Molnar, this plugin also focuses on WordPress Caching without the use of mod_rewrite via .htaccess. It’s the only plugin where disk caching isn’t the default. In fact, disk caching isn’t supported. Instead, WP-FFPC offers several methods (APC, APCu, xCache, PHP memcache, PHP memcached and Nginx memcached) to achieve super fast memory based WordPress caching.

Pros:
– Using PHP 5.5 + Zend opcache + WP-FFPC w/ APCu gave me the fastest results of all 5 plugins!
– Just the right balance of options.

Cons:
– Requires experience with installing at least Memcached, APC or APCu. On CentOS for example this is pretty easy…

Install APCu

…if you are not using php-fpm then restart accordingly.

You can monitor contents, hit rate, etc of APCu using this apc.php file

Install memcached via PHP memcache

You can monitor the contents, hit rate, etc, of PHP Memcache using this memcache.php file.

How to force your WordPress Cache plugin to cache to RAM

If for some reason you need to stick with Hyper Cache, Wp Super Cache or W3 Total Cache, remember you can force them to use memory by mounting the WordPress cache (/wp-content/cache/) folder to tmpfs.

Be Careful!!! Don’t attempt unless you understand what’s being done!

It is probably best to disable your cache plugin first. Also, check the contents of /wp-content/cache/ to make sure that you know what you’ll be moving.

First we mount the WordPress cache directory from disk to tmpfs (server memory). Commands require root privilege:

Next, if still enabled, clear your WordPress plugin’s cache. Then to make this persistent on reboot edit /etc/fstab and add this at the end:

If this has been helpful, comments and questions are welcomed. This post touched on only a tiny fraction of WordPress performance. If you desire more WordPress and Web Server performance, speed and scalability, or would like to optimize the performance of other web applications such as Magento, Drupal, Joomla, etc. …Contact me here.

Best WordPress Cache Plugin: WP-FFPC was last modified: July 13th, 2014 by Hayden James

Tags: ,

Best WordPress Cache Plugin: WP-FFPC

4 Responses

  1. @hayden Do you have specific advice for WordPress caching on PaaS such as OpenShift?

    gavin July 16, 2014 at 7:15 pm #
  2. Hi James,

    thanks for this great article. WP-FFPC looks nice and I will probably test this plugin. But I think you missed another great Cache-Plugin: Cachify (https://wordpress.org/plugins/cachify/)

    Best,
    Josef

    Josef August 10, 2014 at 6:24 pm #

Leave a Reply