WordPress Mu Best Cache Supercache vs Batcache vs DB Cache Reloaded vs W3 Total Cache

Which is the best wordpress cache for wpmu? (assumes you already have opcache of course)

Supercache vs Batcache vs DB Cache Reloaded vs W3 Total Cache

The answer is none of the above.

Let me explain.

Supercache is not very scalable for WPMU due to it using disk and the same goes for DB Cache Reloaded.  If you have multiple servers this renders both of these plugins as not a great option. If DB Cache Reloaded could be used with memcached rather than disk writes that would be awesome.

Batcache and W3 Total Cache are both interesting but I’ve personally found the best caching system is to use a combination of Nginx SSI Memcached and Nginx Fastcgi cache.

I’ve created a caching system which uses these two systems by using my own memcached functions and my own theme framework which allows wordpress to use Nginx (ssi fastcgi) and Memcached superior caching facilities for individual content blocks that make up pages. I did this by creating a rest api for wordpress.

The problem with most wordpress caching systems is they generate the entire page when many pieces of the page do not require regeneration. The difference between my system and others is that mine only generates the unique parts of a page when a page is rendered for the first time. The rest is served from nginx fastcgi cache and memcached.

Testing shows that using this method means first time generation of pages is 3 to 10 times faster than batcached or any other caching system for multi server mu installs. After that Nginx Fastcgi cache takes over for supercached level speeds on second time servings.

This system does not need Nginx Fastcgi and can use memcached exclusively.

3 responses to this post.

  1. Sounds great. Where is it?

    Reply

  2. I don’t really know if there is the demand? I’d have to create something generic from my own set up.

    To get it all working nicely together you need:

    1. The rest api plugin
    2. The theme framework
    3. Specific Nginx conf file
    4. Memcached set up

    Reply

  3. Here are some stats on a single.php first time render of a page. This is before caching of the unique attributes of this page. the_post , comments_template, the_categories etc are all served fresh from the database in this render. All of the other parts of the page that are not unique are served from cache via ssi and nginx. Once this page is produced as is Nginx will serve it for an hour from memcached or ssi cache in less than 0.001 of a second.

    1st Column is time in milliseconds. 2nd Column is queries, and 3rd Column is the do_action stage.

    0.023164 : 5 : widgets_init
    0.024981 : 5 : init
    0.032216 : 12 : posts_selection
    0.036866 : 17 : loop_start
    0.04078 : 19 : wp_footer

    This render speed for single.php is typical in this set up.

    This single.php template has 5 sidebar areas/widgets, served from cache via Nginx ssi.

    1. 20 of the latest posts and associated thumbnails.
    2. Yearly List Archive
    3. Top 20 Categories
    4. Monthly List Archive
    5. A list of all other posts published on the same month as the current post.

    This post also has a related posts content block served from memcached. I set the cache time for related posts for 1 week. When I wasn’t serving related posts from memcached this added an extra 0.2 seconds on the render time.

    I am not using Ryan Boren object-cache.php here because it dramatically decreased performance. Just my own custom memcached functions, the ssi template framework, a wordpress http get api, and nginx.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.