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: January 19th, 2015 by Hayden James

Tags: ,

Best WordPress Cache Plugin: WP-FFPC

21 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 #
  3. Amazing to discover cache plugins I did not know before ! I would be curious to have an advice on Quick Cache – https://wordpress.org/plugins/quick-cache/

    Li-An October 24, 2014 at 1:25 pm #
    • Quick Cache is pretty good! It’s even been around longer than some of the above options. Its good to see it’s being maintained again! It went at one point what seemed to be years without any updates and thus I didn’t keep under radar. Thanks for pulling Quick Cache in.

      Hayden James December 30, 2014 at 10:30 am #
  4. Awesome post on all the caching programs. I have Varnish Cache and what do you recommend as a caching plug-in to go along with it. And why?

    Also do you have any numbers to share with us on load speed.

    Rafael November 16, 2014 at 10:34 am #
    • You don’t really need a WordPress caching plugin if you have FPC via Varnish Cache. It won’t hurt however.

      Hayden James December 30, 2014 at 10:27 am #
      • Well, i have varnish, i installed wp-fppc along with memcached and didnt see any improvements. So i guess you really dont need any wp cache plugin…

        However my question is this: I have varnish, i have also memcached installed. i use memcached on wordpress by putting object-cache.php in wp-content folder and adding a small code to wp-config file..

        is this necessary when you have varnish?

        mert February 18, 2015 at 11:37 pm #
  5. Thank you for this post!
    I’ve just moved my wordpress websites site from shared hosting to VPS. I used WPSC plugin before, but now I’m looking for a better solution. My VPS is 512 RAM, running Ubuntu 14.04, nginx, php5-fpm. Could you please give me any advice what caching method to use? I have 21 small website on it. Thank you!

    Roller December 13, 2014 at 5:10 am #
    • For a 512MB VPS I would recommend using Lite Cache. It’s extremely lightweight and nice for small setups.

      Hayden James December 30, 2014 at 10:34 am #
      • Thank you, Hayden! I am already testing it. Have you tried it on nginx also? I see that it has “htaccess” stuff in settings, so it seems that its more for Apache. Am I wrong?
        Happy Holidays!

        Roller December 30, 2014 at 10:47 am #
  6. Hey Hayden, great post! Could you please give me a recommendation… I have a 2GB VPS with php 5.4.36 and so far I was using W3 total cache with just the disk caching (which now I now is not that good). After I installed APC and set w3tc to work with it the speed actually went down and I started getting some errors in the apache logs.
    My hosting sysadmin uninstalled the APC and things improved. He advises that I ditch the APC (as it’s buggy with my php version) and install Zend Opcache, preferably also upgrade PHP to 5.5. But as much as I’m aware W3tc doesn’t work with Zend opcache so I started to look for other plugins.

    Now after reading your post I feel even more motivated to switch to another caching plugin. Which one of these above would you recommend for php 5.4 (or 5.5) and zend opcache? Or do you have any other setup that you recommend?
    thanks a lot!

    Peter January 22, 2015 at 1:06 pm #
    • Hi Peter,

      I would recommend Lite Cache. Can you check if your VPS has the /dev/shm or /run/shm tmpfs?

      Type: df …in console of VPS and see if its listed. If so, use Lite Cache.

      If not, then use WP-FFPC with APCu (https://github.com/krakjoe/apcu) to cache to RAM. You can run both Zend Opcache and APCu (user/variables cache) together. See above post for details.

      There are many options, even beyond this, but the above makes for an easy start.

      Also check out: https://github.com/pagespeed/ngx_pagespeed

      Hayden James January 27, 2015 at 5:58 am #
      • thanks a lot Hayden!
        btw, by Fast cache do you actually mean Lite cache? (Fast cache plugin is not on the list)
        cheers!

        Peter January 29, 2015 at 2:51 pm #
        • indeed, I meant Lite Cache. Will correct above message now. Thanks.

          Hayden James January 29, 2015 at 7:12 pm #
          • if I might add one more thing :) I see that Lite Cache is no longer actively maintained and the author suggest migrating to his other plugin (Hyper cache). would you, nonetheless, still recommend lite cache as the first option?
            Thank you!

            Peter January 29, 2015 at 9:19 pm #
  7. btw, I am using simfs on tmp on my VPS….
    mount|grep /tmp
    /dev/simfs on /tmp type simfs (rw,nosuid,nodev,noexec,relatime,usrquota,grpquota)
    is that ok?

    ps. sorry for multiple comments

    Peter January 29, 2015 at 10:11 pm #
    • If you view source on my blog notice I use lite-cache still.

      Don’t you already have tmpfs when you list df on your box. Usually you don’t have to manually mount. Just have to enter correct path in Lite Cache (Hyper Cache was recently updated to have the same option for cache path as well).

      Hayden James February 20, 2015 at 5:56 pm #
  8. In my case:
    VPS (1x 3.2GHz CPU, 3GB RAM, 3GB vSwap)
    OS: CentOS 5 or Ubuntu 12 64bit /w cPanel/WHM
    Apache: 2.4.10
    PHP: 5.5.20
    MySQL: 5.5.40-cll
    Zend Opcache
    2x WP MU (Multisite) Setup with subdomains & Domain Mapping and some single wp in feature

    I type df in console of VPS and show me this:
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/simfs 103079200 18341944 79494480 19% /
    none 1572864 4 1572860 1% /dev

    What cache plugin I must use?

    Alex February 19, 2015 at 3:14 pm #
    • Those specs don’t influence what should be used. For beginners, use Lite Cache or Hyper Cache.

      Hayden James February 20, 2015 at 5:50 pm #

Leave a Reply