Problem/Motivation
Currently, all cache items get a TTL, if none is set then for 1 year. This allows to separate them from cache tags and avoid them from expiring when using a volatile-* eviction policy.
Some cache bins have a fixed max size and will not really grow beyond that, such as config, bootstrap and discovery. I think it's useful to not have those items expire at all. While redis should be pretty good at keeping them around with something like volatile-lfu, this should help with that.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork redis-3570205
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
shank115 commentedCurrently, the Redis module assigns a TTL to all CACHE_PERMANENT items (default ~1 year), even for bins that are effectively bounded in size and rarely updated, such as config, bootstrap, and discovery.
I suggest we explicitly support setting the TTL to 0 (or a negative value) to skip the EXPIRE call entirely for these bins, in settings.php:
This approach reduces unnecessary TTL operations while keeping the intended permanent nature of bounded cache bins.
Comment #3
drupalite1411 commentedWe also haven't set these ttl values in our settings.php.
We are getting RedisException in our dblog randomly.
We are using pantheon and they are reporting that the main reason that the error RedisException: read error on connection to 10.73.8.170:11034 in Redis->hGetAll() (line 60 of /code/docroot/modules/contrib/redis/src/Cache/PhpRedis.php) is happening is due to the amount of Object Cache that is still in the memory and is causing it to reach the limit of its memory.
Although we are not still convinced that setting ttl will resolve this error.
Not able to understand the cause of it.
These are the recommended values:
$settings['redis.settings']['perm_ttl'] = 2630000; // 30 days
$settings['redis.settings']['perm_ttl_config'] = 43200;
$settings['redis.settings']['perm_ttl_data'] = 43200;
$settings['redis.settings']['perm_ttl_default'] = 43200;
$settings['redis.settings']['perm_ttl_entity'] = 172800;
Also they are using the maxmemory policy is allkeys-lru evict keys by trying to remove the less recently used (LRU) keys first, in order to make space for the new data added.
Comment #5
berdir@drupalite1411: That has nothing to do with that issue. My recommendation is in the docs and it's to not customize the perm ttl like that and rely on eviction, preferably volatile eviction only. I don't know anything about pantheon though. https://project.pages.drupalcode.org/redis/#expiration-of-cache-items
Implemented this using -1 and also unified with the existing relay specific setting to apply this by default.
Comment #7
berdirMerging this.