Redis Cache By Xon

Redis Cache By Xon 2.17.2

No permission to download
We are trying to get a Redis sentinel setup (1 master, 2 slaves) to work with guest page caching.

We have this addon by @Xon installed:


My config.php:

PHP:
$config['cache']['enabled'] = true;
$config['cache']['namespace'] = 'xfredis_';
$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['config']['server'] = 'tcp://**.**.**.**:26379,tcp://**.**.**.**:26379,tcp://**.**.**.**:26379';
$config['cache']['config']['sentinel_primary'] = 'mymaster';
$config['cache']['config']['load_from_replicas'] = '2';
$config['cache']['config']['replica_select_callable'] = 'preferLocalReplicaLocalDisk';
$config['pageCache']['enabled'] = true;
$config['pageCache']['lifetime'] = 900;
$config['pageCache']['recordSessionActivity'] = true;
$config['cache']['context']['page']['namespace'] = 'xfredispages_';
$config['cache']['context']['page']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['context']['page']['config'] = [
        'host' => '**.**.**.**',
        'port' => 6379,
        'database' => 1,
        'serializer' => 'igbinary',
];

Another try:

PHP:
$config['cache']['enabled'] = true;
$config['cache']['namespace'] = 'xfredis_';
$config['cache']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['config']['server'] = 'tcp://**.**.**.**:26379,tcp://**.**.**.**:26379,tcp://**.**.**.**:26379';
$config['cache']['config']['sentinel_primary'] = 'mymaster';
$config['cache']['config']['load_from_replicas'] = '2';
$config['cache']['config']['replica_select_callable'] = 'preferLocalReplicaLocalDisk';
$config['pageCache']['enabled'] = true;
$config['pageCache']['lifetime'] = 900;
$config['pageCache']['recordSessionActivity'] = true;
$config['cache']['context']['page']['namespace'] = 'xfredispages_';
$config['cache']['context']['page']['provider'] = 'SV\RedisCache\Redis';
$config['cache']['context']['page']['config']['server'] = 'tcp://**.**.**.**:26379,tcp://**.**.**.**:26379,tcp://**.**.**.**:26379';

But it seems guest page caching does not work with this config: no activity on the redis instance. Are we missing something?

When we tried to move with guest page caching only back to Memached nothing seemed to be cached either. Can 2 Cache providers be mixed?
 
$config['cache']['context']['page']['config'] needs to essentially be a full copy of $config['cache']['config']
 
When performing a batch thread update (like moving threads), thread counters in Redis are not invalidated which can be confusing (like showing no pagenav as the the counter in redis is zero).

Might be a nice idea to (optionally) invalidate the counters after batch operations.
 
Thank you! With the addition of 'serializer' => 'igbinary', I suppose?
By default igbinary will be used if it is installed, so you can just omit that line.

When performing a batch thread update (like moving threads), thread counters in Redis are not invalidated which can be confusing (like showing no pagenav as the the counter in redis is zero).

Might be a nice idea to (optionally) invalidate the counters after batch operations.
Next version will purge the cached forum counts after various bulk thread operations. It uses a unique job to avoid blocking the main request and to page through the cache entries.
 
Redis stats in AdminCP have disappeared.
What version did you upgrade from?
Is the add-on actually in a valid state?

If the add-on is stuck upgrading then the various integrations will disappear even if the caching backend still works.
 
@Xon One more issue with merge posts. When merge posts in thread then redirect to forum homepage, not standing into threads.
Does that happen if you disable this add-on? The redis integration will still function, just all the caching behavior will be disabled.
 
Does that happen if you disable this add-on? The redis integration will still function, just all the caching behavior will be disabled.

Yes this will be also happened with disabled this add-on. Does not know why this is happening.
 
This addon is awesome. Compared to Elasticsearch, Redis is shockingly easy to install and configure. I had it up and running in < 30 minutes.

Thank you for this resource.
I've never used Elasticsearch, but was using Memcached, which was tedious to install and used more resources. Redis directly integrated with XF, so I can see that it is running right from the Admin CP. It is also easier on resources, and as you said, was very easy to implement!
 
Xon updated Redis Cache By Xon with a new update entry:

2.15.0 - Maintenance update

  • Remove displaying if Lua is configured or not, and remove the Lua enable/disable option.
    • Lua support was first added to redis v2.6.0, and this add-on required redis v3
  • Rework caching provider code in preparation for XenForo 2.3
    • XF have documented they are switching from Doctrine/Cache to Symfony/Cache
    • I have not tested this on XF2.3, and have coded against the public interfaces of the Symfony/Cache package.
    • A future release may be required for...

Read the rest of this update entry...
 
Are there any server-side settings of Redis for a high-load project?
We tried to use Redis on our high load project (10 000 queries per second) and had problems with page loading (too long response from Redis like 1s instead 0.0006s for Libmemcached). We tried to enable Redis only for few people and there are not problems with page loading.
 
Are there any server-side settings of Redis for a high-load project?
We tried to use Redis on our high load project (10 000 queries per second) and had problems with page loading (too long response from Redis like 1s instead 0.0006s for Libmemcached). We tried to enable Redis only for few people and there are not problems with page loading.
Do you have multiple webservers or did you put the redis master on another server?

Xenforo is quite read heavy so you can use primary/replicas to easily scale out read capacity for redis, and use "redis sentinel" for php to locate the writeable primary when needed.

When using sentinel config, you can set the following options:
PHP:
$config['cache']['replica_select_callable'] = 'preferLocalReplicaLocalDisk';
$config['cache']['load_from_replicas'] = 2;  // include primary if it is local
$config['cache']['retry_reads_on_primary'] = true;
This will dump the IPs of the local machine to php's /tmp and select the replica which is local to the machine (or if the primary if it is on the same machine).

retry_reads_on_primary means if the key fails to be fetched from the replica, it tries again on the primary. This essentially is designed to workaround delayed replication when a key expires and another request has likely regenerated the data already.
 
Do you have multiple webservers or did you put the redis master on another server?

Xenforo is quite read heavy so you can use primary/replicas to easily scale out read capacity for redis, and use "redis sentinel" for php to locate the writeable primary when needed.

When using sentinel config, you can set the following options:
PHP:
$config['cache']['replica_select_callable'] = 'preferLocalReplicaLocalDisk';
$config['cache']['load_from_replicas'] = 2;  // include primary if it is local
$config['cache']['retry_reads_on_primary'] = true;
This will dump the IPs of the local machine to php's /tmp and select the replica which is local to the machine (or if the primary if it is on the same machine).

retry_reads_on_primary means if the key fails to be fetched from the replica, it tries again on the primary. This essentially is designed to workaround delayed replication when a key expires and another request has likely regenerated the data already.
We have only one web server.
 
Top Bottom