Skip to content

Redis cache grows unilimmited #25487

Closed
Closed
@toxix

Description

@toxix

Preconditions (*)

  1. Magento 2.3.3
  2. Redis Cache enabled
  3. Production mode

Steps to reproduce (*)

  1. Run Magento in Production with 15 Stores and organic trafic
  2. Redis caching enabled

Expected result (*)

  1. Redis cache will stabilize in size.
  2. Cache key expiery is set for all things that do have an expiery

Actual result (*)

  1. Redis is growing in size to unlimited (>30GB)
  2. Cache key expirey is not set
> info keyspace
# Keyspace
db0:keys=45775,expires=41711,avg_ttl=79567831
db1:keys=49089,expires=27837,avg_ttl=16355872
db2:keys=706,expires=706,avg_ttl=696476

Further information

The only way to prevent our production system server from dying was to set a hard limit for Redis memory consumption. The relying on the memory limit of redis has some performance impact and there are always things cleared that don't need to and vice versa. This should be handled by the application with setting an resonable ttl.

fix

This is actualy an known bug and already long time fixed in an dependency of magento core composer file. See also colinmollenhour/Cm_Cache_Backend_Redis@bc63e72
But this is not included in current magento version Last update of this core depedency was in September 2018: 32058c7

Applying this change as a hotfix, actualy stabalize our production redis at 3,5GB ram usage, instead of growing over 30GB. And also boost the performance of the system quiete a bit.

Hot Fix

Add the following requirement to your project composer.json file:

    "colinmollenhour/cache-backend-redis": "1.11.0 as 1.10.6"

Fix

I will File a PR with an updated composer dependency to the magento core and reference this issue.

Metadata

Metadata

Assignees

Labels

Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions