Redis Cache By Xon

Redis Cache By Xon 2.18.0

No permission to download
Compatible XF 2.x versions
  1. 2.1
  2. 2.2
  3. 2.3
Additional requirements
php 7.2+
Redis (v3.0.0 or better)
phpredis (for performance)
License
MIT Licence (add-on), New BSD (Redis Zend component)
Visible branding
No
This add-on uses Credis with a custom cache provider for Redis. For best performance, install the php extension: phpredis

You must have a Redis instance installed, this is likely not possible with shared hosting

While XenForo 2 has a redis connector, it requires phpredis. This add-on does not.

Feature overview
  • A pure php redis connector
  • High availability support
  • Exposes redis cache object for use for use by other add-ons
  • Implements some minor caching of forum thread counts
  • Redirect's XenForo's individual css template caching to hit redis as otherwise it causes unexpected write & deadlocking on the xf_css_cache table
Installation

Edit src/config.php and add:
PHP:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['config'] = [
    'server' => '127.0.0.1',
    'port' => 6379,
];
For details see the XenForo Manual: https://xenforo.com/docs/xf2/cache/

@eva2000 has also written an in-depth walkthrough around setting up redis and this add-on:
See "Xon's Redis Cache Addon For Xenforo 2.x" from:
Troubleshooting

Please be aware that Redis is very sensitive to latency in a virtual environment. If repeated connection failures or protocol errors are experienced disable any Redis Persistence options.

Options
By default, forum thread counts are cached. In general, this is observable when moving large number of threads from one forum to another, and the total page counts are wrong.
redis-options.png



Redis Statistics
Admincp dash board is extended with basic redis statistics:

redis-stats.png


Debugger Statistics
Include redis timings when using the _debug=1 view for a page

Read Scaling

With the $config['cache']['config']['load_from_replica'] option, reads can be deferred to a singular replica instance. This takes all the options of 'config' (except the replicaconfig)

See the FAQ for configuration samples.

High availability

The Zend component support primary/replica setups with Redis Sentinel support. It does not support Redis multi-master clustering.
  • Additionally, this add-on implement caching of thread counts in a forum.
  • Redis Sentinel support for high-availability (see FAQ for details).
Licencing

Components licenced under; New BSD
  • Credis
Components licenced under; MIT Licence
  • XenForo Add-on code
Contributing features or bug fixes
Please create a GitHub Pull request via the "More Information" link.

Contributions

If you appreciate this add-on, please consider a contribution via PayPal. Details will be provide via private conversation.

Please contact me if you wish for different licencing arrangements.
Related resources
  • xf-debugger-stats.webp
    xf-debugger-stats.webp
    18.6 KB · Views: 107
Author
Xon
Downloads
1,030
Views
32,104
First release
Last update

Ratings

5.00 star(s) 12 ratings

More resources from Xon

Latest updates

  1. 2.18.0 - Feature update

    Restore XF2.1 support
  2. 2.17.2 - Bugfix update

    Fix high availability support where css updates would be sent to a possible readonly replica...
  3. 2.17.1 - Bugfix update

    Fix XF2.3 compatibility when css caching is enabled

Latest reviews

Nothing short of amazing. Performance, response time, and cpu load seemed to improve by at least double. I tried tuning my database and everything else first with limited success. Had the stock redis previously. This add-on did the trick. 10 stars! Approx forum size: Threads 2 Million, Messages 15 Million.
Great plugin. Redis is easy to install and this plugin is very helpful in tuning for Xenforo. Xon always has great AddOns.
Great Add-on. I'm using two instances using the following configuration;

#redis cache
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Redis';
$config['cache']['config'] = [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
];
#redis guest cache
$config['pageCache']['enabled'] = true;
$config['cache']['context']['page']['provider'] = 'Redis';
$config['cache']['context']['page']['config'] = [
'host' => '127.0.0.1',
'port' => 6380,
'database' => 0,
];
}

If you want to do the same ->
https://gist.github.com/akhdaniel/04e4bb2df76ef534b0cb982c1dc6225b

Thanks!
X
Xon
I recommend setting `$config['cache']['provider'] = 'SV\RedisCache\Redis';` (and then simliar for the page context) not just the stock `Redis` adapter.
Awesome tool, everything incorporates into the admin panel nicely as well. A must have add-on for those running Redis.
Great addon, thank you for providing this solution to improve the performance of our websites. Maybe in the future you can think of a way to integrate in this addon a Redis Cache force purge option/button.
I've used this for over a year on a large forum with over 20 million posts. It's been working with no problems. Honestly my benchmarking isn't good enough to exactly how much this improved things, but it didn't break anything either.
Same addition as this https://xenforo.com/community/resources/optimized-list-queries-by-xon.6869/. Also, if the developer would look towards the predis or phpreact library, where there is completely asynchronous caching. It would be much more interesting to watch this. This supplement is what is missing from the box and should be required. Specifically, in the current version, the set of features is very scarce.
We've been dealing with some serious server load issues since upgrading from XF 1.5 to XF 2.1. Out of ideas, we decided to give this a shot. I'm not exaggerating when I say our CPU usage went from near 50% to the 20's. If you're not running this, you should be.
Forum back again to turbo speed with this addon on my large forum with these stats:
Threads107,422
Messages1,682,218
Members20,965
A must have!
Xon has some of the most useful addons and this is one of them. He also has unrivaled support. Literally fixing bugs within a day.
Back
Top Bottom