EasyEngine 3.3 released with Full-Page Redis Cache support

In this EasyEngine release, we have added support for full-page redis cache support.

Unlike other methods around, this works without any changes to WordPress index.php file or any plugin to add pages in redis-cache.

With this new method some benchmarks we done using loader.io and it showed 3-4x improvement over fastcgi-cache. But benchmark/performance is not a reason for experimenting  with redis cache.

We needed a caching solution which works across multiple servers.  So the only choice was to go with something like memcache/redis. Both supported master-slave replication and both performed equally.

We chose to go with Redis as it seems to be a lot easier to work with. Another plus was that we like redis feature, where it can save/reload cache from the disk. This can be used in some very creative ways for some really big sites. We will write more about the more “creative” stuff some other day!

Let’s get going with the new feature. 🙂

Usage

First, you will need to update EasyEngine itself by running ee update

Then you can create a new site using ee site create example.com --wpredis

or update an existing site using ee site update example.com --wpredis

Please note that multi-server setup is not present currently in EasyEngine. But we hope to provide some documentation soon and of course some EasyEngine commands in the future.

Experimental warning!

When you will run the above commands, you will get a warning from EasyEngine. As this is a new caching method and it also uses redis as object-cache (instead of W3 Total Cache), we thought it was better to warn users in advance.

We are using this feature here on rtcamp.com and moved many of our managed-hosting clients to new caching method last week. It’s working really great so far but we really like you to understand risks involving a new cutting-edge feature.

We recommend, you use redis cache when you have some extra time to verify if the site is working really nice. If you face any issues, you may deactivate redis-cache object-cache plugin first. This would have been added by EasyEngine for object-cache.

Going ahead we are planning to move away from W3 Total Cache for object caching. So with --wpredis we have changed full-page caching method and WordPress object-cache method.

Implementation Details

Cache Get/Set

We have used four nginx modules, srcache-nginx-moduleredis2-nginx-moduleHttpRedisModule and set-misc-nginx-moduleto, get everything working on nginx.

Our nginx build has already been upgraded with all the required packages.  This was to avoid using a WordPress plugin to buffer entire output and write to redis cache. We always try to handle things on nginx end first.

Cache Purging

We have also updated nginx helper plugin, so it now has redis support. So now whenever you edit/publish some content, some post and pages will be purged from redis cache.

FAQ

With new redis-cache we have stopped installing W3TC. We are anticipating a few questions and thought it would be proactive to answer some in advance.

Does Redis Cache fix PageSpeed and Fastcgi Cache issue?

PageSpeed doesn’t work nicely with fastcgi-cache as being discussed here. Unfortunately, PageSpeed runs into similar problem with Redis cache module also.

Currently we have stopped using PageSpeed and W3TC internally for all our sites.

How do you manage CDN without PageSpeed or W3TC?

We use nginx subs-filter module to replace file URLs. This method works nicely for origin pull CDNs e.g. Amazon CloudFront.

You can edit a site (ee site edit example.com command) and a line like below to server{ } block.

subs_filter http://example.com/wp-content/uploads http://cdn.example.com/wp-content/uploads;

Above will replace all point and all file paths to your CDN domain. Please note example.com is the original domain while cdn.example.com will be your CDN domain. Verify page output after you save changes.

What about CSS/JS minify and combine without PageSpeed or W3TC?

We are using autoptimize WordPress plugin to manage css/js minification and combining for now. So far, it’s working well for CSS. We really never got any plugin or even pagespeed working nicely for JS files.

Currently we are not installing this plugin as part of EasyEngine site creation process. You may add it separately.

You are free to use any other plugin or even pagespeed. But remember, pagespeed will break full-page cache.

How Redis Full Page Caching Works without WordPress/PHP?

We are using a third-party nginx module for subrequest based caching.

Here is out it works in general – https://github.com/openresty/srcache-nginx-module#description

And here is redis part – https://github.com/openresty/srcache-nginx-module#caching-with-redis

The whole readme is worth reading.

This was on the list for a long time but we did not manage to have enough time and resources to dedicate towards it. As with any new feature, it needs a lot of time in testing, tweaking and playing around before it can be made “easy”.

Need Support?

If you run into any issues or have any questions, please use our community support forum.

If you are using EasyEngine Premium Support, you can create a support request and let our team update EasyEngine as well as move your sites to new redis cache.

Also, if you use new redis-cache, please share your feedback.

Links: EasyEngine Home | Github Repo | Release Notes | EasyEngine Docs