Introduction:-
There are some cases where it is possible to observe high usage in Redis. This high usage might cause slowness in the run execution.
Background:-
Redis stores data in memory, rather than on a disk or solid-state drive (SSD), which helps deliver unparalleled speed, reliability, and performance.
Redis stores data as key/value pair.
TFE runs a sidekq job to clear up the stale keys to utilize the maximum memory size of the redis instance . The stale keys that are not in active lock digests are deleted in a batch to avoid blocking redis memory.
Sometimes even after TFE clearing the stale keys it is possible that memory utilisation is high. Redis also manages the eviction at its end when one of the Active-Active instances reaches 80% of its memory limit. If memory usage continues to rise while the keys are being evicted, the rate of eviction will increase to prevent reaching the Out-of-Memory state.
The eviction policy determines what happens when a database reaches its memory limit. To make room for new data, older data is evicted (removed) according to the selected policy.
Solution:-
By default, volatile-lru is the default eviction policy for most databases and the default policy for Active-Active databases is noeviction policy.
The recommendation is to upsize the Redis to 8 GB to 16 GB for Active-Active TFE set up . The optimal eviction policy is no-eviction.
References:-
https://redis.io/docs/latest/operate/rs/databases/memory-performance/eviction-policy/#:~:text=The%20eviction%20policy%20starts%20to,Out%2Dof%2DMemory%20state.