Redis Cache By Xon

Redis Cache By Xon 2.18.3

No permission to download
If you're using Xon's addon, use his recommended settings in the FAQ.

A lot of configuration in there. For example this is my own config but I'm not sure it's perfect or not:

Code:
// === Redis main cache ===
$config['cache']['enabled']   = true;
$config['cache']['provider']  = 'SV\RedisCache\Redis';
$config['cache']['namespace'] = 'xf';

$config['cache']['config'] = [
    'server'            => '127.0.0.1',
    'port'              => 6379,
    'password'          => null,
    'database'          => 0,
    'timeout'           => 2.5,
    'read_timeout'      => 2.5,
    'connect_retries'   => 1,
    'persistent'        => false,
    'force_standalone'  => false,
    'serializer'        => 'php',
    'use_lua'           => true,
    'lifetimelimit'     => 2592000,
    'compress_data'     => 1,
    'compress_threshold'=> 20480,
    'compression_lib'   => null,
    'retry_reads_on_master' => true,
];

// === Guest page cache ===
$config['pageCache']['enabled']  = true;
$config['pageCache']['lifetime'] = 600;

$config['cache']['context']['page']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['context']['page']['config'] = [
    'server'            => '127.0.0.1',
    'port'              => 6379,
    'password'          => null,
    'database'          => 1,
    'timeout'           => 2.5,
    'read_timeout'      => 2.5,
    'connect_retries'   => 1,
    'persistent'        => false,
    'serializer'        => 'php',
    'use_lua'           => true,
    'compress_data'     => 1,
    'compress_threshold'=> 20480,
];
 
Thats definitely not a default config. Why over complicate it?

Is it enough? I just want some performance as you know...

Code:
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['config'] = [
    'server' => '127.0.0.1',
    'port' => 6379,
    'database' => 0,
];

$config['pageCache']['enabled'] = true;
$config['cache']['context']['page']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['context']['page']['config'] = [
    'server'            => '127.0.0.1',
    'port'              => 6379,
    'database' => 1,
];
 
Why not just something simple like:

Code:
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['config'] = [
    'server' => '127.0.0.1',
    'port' => '6379',
    'database' => 0,
    'compress_data' => 3,
    'use_lua' => true,
    'serializer' => 'igbinary',
    'compress_threshold' => 20480,
];

Change your serializer if you don't have the igbinary installed.

add page cache if needed.
 
A bit out of my depth to be honest. I use igbinary because I thought it had the best performance/balance. But yeah, bit out of my depth to comment. Perhaps @Xon can comment?
 
A bit out of my depth to be honest. I use igbinary because I thought it had the best performance/balance. But yeah, bit out of my depth to comment. Perhaps @Xon can comment?
This.
I switched to igbinary because in my research it can and does need less ram (my vps is ram challenged). I was able to lower my maxmemory. I also use maxmemory-policy allkeys-lru as during my research that was best when using Redis for cache. Who knows, maybe I'm wrong. That is why I commented out the PHP and the maxmemory settings I had and can switch back quickly. Can't wait to see what @Xon says.
 
Last edited:
The igbinary serializer is preferred as it typically performs better when decoding which is what happens the majority of the time.

The phpredis extension implements the redis protocol in C which generally performs better, but with v8.0+ the performance different is actually fairly margin now days.

Should I use replicas or sentinel etc.
These are fairly complicated, and well outside what I offer for free support as "It Depends". And without customized support and testing, it is hard to determine anything besides that.
 
The igbinary serializer is preferred as it typically performs better when decoding which is what happens the majority of the time.

The phpredis extension implements the redis protocol in C which generally performs better, but with v8.0+ the performance different is actually fairly margin now days.


These are fairly complicated, and well outside what I offer for free support as "It Depends". And without customized support and testing, it is hard to determine anything besides that.
Thanks for the info @Xon . This is what I ended up with after switching from PHP. Significantly less ram. I'm slowly reducing maxmemory as it runs and I look at peak.

red7.webp
 
Last edited:
The Redis information block is currently shown to all administrators.

This does contain some sensitive information (Redis version, etc.) and might not be relevant anyway for administrators with limited permissions.

Could this be changed so the block is only shown to administratos with permission serverInfo on XF 2.3.4+?
 
The Redis information block is currently shown to all administrators.

This does contain some sensitive information (Redis version, etc.) and might not be relevant anyway for administrators with limited permissions.

Could this be changed so the block is only shown to administratos with permission serverInfo on XF 2.3.4+?
If you have admins you trust so little that you don't want them to see your redis version... You've got much bigger problems than hiding that display.
 
This statement IMHO demonstrates lack of common sense for security ;)


It doesn't really matter if I trust admins or not, displaying this information is not necessary for admins with limited privileges and it therefore should not be shown to reduce possible attack vectors - especially as XenForo introduced a new permission in 2.3.4 to address this.

 
Question. I'm building a video game release calendar that's pretty much complete aside from a few odds and ends. It pulls in release dates via IGDB API and caches the JSON results in internal_data. Is there any real world benefit to caching this with Redis if available?
 
Last edited:
The advantage of caching in redis is the auto-expiry, but for external blobs which are being fetched off-site internal_data or the database would be better for more durable results. It depends on size, for a small json blob I'ld recommend the database.
 
Back
Top Bottom