Resource icon

Zend Redis Cache 1.6.0

No permission to download
Besides the password issue above, I have one final issue trying to work through.

"Q: phpredis supports persistent connection, are these recommended?
A: I do not recommend using persistent connections, as they appear to be quite buggy."

Can someone direct me how to disable persistent connections? I was not to figure out how to do it. Sincerely appreciate the help.
 
Last edited:
Im not sure what you mean by that? :confused: If I comment "#" out the password it works. How do I get it to work using the password?
Please use the minimal config which will set itself up correctly, as the other config example simply shows all the options. Just setting the password is enough for it to try to use a password, even if that password is empty.
 
When I use this config (disable saving), After I upgrade Redis to 3.0.7, it ask me to upgrade XenForo again, Why?
And I lost some cache also like bd widgets.

When redis restarts, it automatically loads any dump.rdb or appendonly.aof from /var/lib/redis/, you likely have a stale file in there.

Flush the cache via: "redis-cli flushall" , the affected bits should sort themselves out.

You can avoid this by deleting those files, or doing a "redis-cli save" before restarting or upgrading Redis.

Similiar ptoblem I have @Xon
After shutdown server for backup, and when server is reboot again, redis load old cache, last one before I changed to no save:
#save 900 1
#save 300 10
#save 60 10000

After reboot Xenforo need to upgrade, like it was in @RoldanLT case.
To avoid that, I delete manually dump.rdb and appendonly.aof from /var/lib/redis/
I flush cache then, and did "redis-cli save" after that. It created new dump.rdb

So, is there something else I have to do, or I need to manually do that things after/before restarting server?
 
Either manually do it, or put it in a shutdown script. Or in your startup script to remove the dump.rdb file.
 
What if I don't execute "redis-cli save"? Will dump.rdb will be created automatically?

manually do it
So before shutdown server, I have to delete manually dump.rdb from /var/lib/redis/
After sturtup I do not have to manually execute "redis-cli save" then?
 
What if I don't execute "redis-cli save"? Will dump.rdb will be created automatically?
Redis will skip loading the content, and XenForo will need to regenerate cached data. If the file exists, it can load the data and save rebuilding caches.

So before shutdown server, I have to delete manually dump.rdb from /var/lib/redis/
After sturtup I do not have to manually execute "redis-cli save" then?
The other way around;
  • Ssave before shutdown if you want to have the cache reload.
  • Delete before startup if you want to ensure the cache isn't stale.
 
Problem is that I have to manually shutdown, but server automatically start after backup is finished.
So if I understand this correctly, my steps will be:
  • redis-cli save (it will overwrite old dump.rdb)
  • shutdown -h now
and when server start, redis will load last cache from manually saved dump.rdb from /var/lib/redis/ before shutdown


Redis will skip loading the content, and XenForo will need to regenerate cached data.
Will be some problems if I do it that way? How long for xenforo to generate cache, and will there be some performance trouble till that finished?

If my configuration is:

I change appendonly yes to appendonly no
And comment this three rows:
#save 900 1
#save 300 10
#save 60 10000


then there is no automatically created/saved dump.rdb so before shutdown I have to allways save or left xenforo to generate own cache.
 
Last edited:
Problem is that I have to manually shutdown, but server automatically start after backup is finished.
So if I understand this correctly, my steps will be:
  • redis-cli save (it will overwrite old dump.rdb)
  • shutdown -h now
and when server start, redis will load last cache from manually saved dump.rdb from /var/lib/redis/ before shutdown
Yes, this will work.



Will be some problems if I do it that way? How long for xenforo to generate cache, and will there be some performance trouble till that finished?

If my configuration is:

I change appendonly yes to appendonly no
And comment this three rows:
#save 900 1
#save 300 10
#save 60 10000


then there is no automatically created/saved dump.rdb so before shutdown I have to allways save or left xenforo to generate own cache.
Correct, this will also work.

As for the performance impact, you can trigger it by doing a "redis-cli flushall" and seeing what impact it has on your site. It depends on the time of day, and load.
 
Correct, this will also work.
This is my configuration last month or two, but problem was two old files in /var/lib/redis/ before save lines commented and appendonly set to no.

Maybe I do not understand this correct, but I think that I have one step too much.

If directory /var/lib/redis/ is empty, and configuration is like I wrote in last post, than I do not need to manually do redis-cli save at all.
After redis restarted, it will wait to xenforo create cache?

OR

It will be better to manually execute redis-cli save before shutdown server, even with redis configuration with no save and appendonly set to no
 
@Xon

I was using the Redis with minimal config with use_lua = true only.

But i see your example configuration file on the add-on file and it has very detail. Should i use them or do you advice it ? Especially you configured the use_lua as false. (it was true for me because of your previously advices)

Code:
$config['cache']['backendOptions'] = array(
        'server' => '127.0.0.1',
        'port' => 6379,
        'timeout' => 2.5,
        'persistent' : '',
        'force_standalone' => false,
        'connect_retries' => 1,
        'read_timeout' => '',
        'password' => '',
        'database' => 0,
        'notMatchingTags' => false,
        'compress_tags' => 1,
        'compress_data' => 1,
        'lifetimelimit' => 2592000,
        'compress_threshold' => 20480,
        'automatic_cleaning_factor' => 0,
        'compression_lib' => '', // dynamically select first of; snappy,lzf,l4z,gzip
        'use_lua' => false,
        'sunion_chunk_size' => 500,
        'lua_max_c_stack' => 5000,
        );

Also what is doing that ? Will be available on xenforo 2.x ?
Code:
$redis = XenForo_Application::getCache()->getBackend()->getCredis();
 
Last edited:
@Xon

I was using the Redis with minimal config with use_lua = true only.

But i see your example configuration file on the add-on file and it has very detail. Should i use them or do you advice it ? Especially you configured the use_lua as false. (it was true for me because of your previously advices)

Code:
$config['cache']['backendOptions'] = array(
        'server' => '127.0.0.1',
        'port' => 6379,
        'timeout' => 2.5,
        'persistent' : '',
        'force_standalone' => false,
        'connect_retries' => 1,
        'read_timeout' => '',
        'password' => '',
        'database' => 0,
        'notMatchingTags' => false,
        'compress_tags' => 1,
        'compress_data' => 1,
        'lifetimelimit' => 2592000,
        'compress_threshold' => 20480,
        'automatic_cleaning_factor' => 0,
        'compression_lib' => '', // dynamically select first of; snappy,lzf,l4z,gzip
        'use_lua' => false,
        'sunion_chunk_size' => 500,
        'lua_max_c_stack' => 5000,
        );
Please use the minimal example as the sample configuration. The rest are advanced options which I documented so I didn't need to go diving into code to find them.

Also what is doing that ? Will be available on xenforo 2.x ?
Code:
$redis = XenForo_Application::getCache()->getBackend()->getCredis();
This is part of the RedisCache add-on, and is used todo raw communication to Redis bypassing the standard cache interface XF uses.
 
Please use the minimal example as the sample configuration. The rest are advanced options which I documented so I didn't need to go diving into code to find them.


This is part of the RedisCache add-on, and is used todo raw communication to Redis bypassing the standard cache interface XF uses.
Okay i will continue to use the minimal config BUT i have two question.

1. Should we use the "use_lua = true" for this add-on and xenforo ? What is the difference that it is true or false

2. Is it safe to use that code end of the config.php ?

Code:
$redis = XenForo_Application::getCache()->getBackend()->getCredis();
 
Okay i will continue to use the minimal config BUT i have two question.

1. Should we use the "use_lua = true" for this add-on and xenforo ? What is the difference that it is true or false
As long as you have a recent version of Redis (+2.4) yes, it should be true.

2. Is it safe to use that code end of the config.php ?

Code:
$redis = XenForo_Application::getCache()->getBackend()->getCredis();
That is an example of how to access the raw redis object for developers. Normally users should not use it.
 
Finally migrated from Memcached to Redis,

1.png


What's a good benchmark to run for Redis? I'd like to test speed.
 
I got this errors.
Error Info
CredisException: protocol error, got 'a' as reply type byte - library/Redis/lib/Credis/Client.php:1074
Generated By: Unknown Account, Today at 12:00 PM

Stack Trace
#0 /library/SV/RedisCache/RedisDataRegistry.php(175): Credis_Client->__call('exec', Array)
#1 /library/XenForo/Dependencies/Abstract.php(147): XenForo_Model_DataRegistry->getMulti(Array)
#2 /library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
#3 /index.php(13): XenForo_FrontController->run()
#4 {main}

Request State
array(3) {
["url"] => string(67) "http://www.site.net/t/threadtitle.85422/"
["_GET"] => array(1) {
["/t/naruto-fight-shadow-blade-x-v0-4-0_85422/"] => string(0) ""
}
["_POST"] => array(0) {
}
}


Error Info
CredisException: read error on connection - library/Redis/lib/Credis/Client.php:1074
Generated By: Unknown Account, Today at 12:00 PM

Stack Trace
#0 /library/Redis/lib/Credis/Client.php(608): Credis_Client->__call('select', Array)
#1 /library/Redis/Cm/Cache/Backend/Redis.php(144): Credis_Client->select(0)
#2 /library/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array)
#3 /library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Redis', Array, false, false)
#4 /library/XenForo/Application.php(763): Zend_Cache::factory('Core', 'Redis', Array, Array)
#5 /library/XenForo/Application.php(973): XenForo_Application->loadCache(Object(Zend_Config))
#6 /library/XenForo/Application.php(1004): XenForo_Application->lazyLoad('cache', NULL)
#7 /library/XenForo/Application.php(1649): XenForo_Application::get('cache')
#8 /library/XenForo/Model.php(146): XenForo_Application::getCache()
#9 /library/SV/RedisCache/RedisDataRegistry.php(152): XenForo_Model->_getCache(true)
#10 /library/XenForo/Dependencies/Abstract.php(147): XenForo_Model_DataRegistry->getMulti(Array)
#11 /library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
#12 /index.php(13): XenForo_FrontController->run()
#13 {main}

Request State
array(3) {
["url"] => string(49) "http://www.site.net/t/threadtitle.99150/page-19"
["_GET"] => array(1) {
["/t/smart-bug_99150/page-19"] => string(0) ""
}
["_POST"] => array(0) {
}
}
 
@RoldanLT these can happen sometimes if the connection gets into a wierd state or if there is blocking IO affecting Redis. Generally you can ignore them.

Try upgrading your version of phpredis, as 3.0.0rc1 has dropped.
 
  • Like
Reactions: rdn
Top Bottom