Databases

Redis memory keeps growing after cache keys expire

Environment

Environment

Redis 7 used as a cache for a Node.js API in Docker.

What happens

What happens

Key count falls after expiry but RSS memory stays close to the previous peak.

What I have tried

What I have tried

Confirmed TTLs and checked that no persistent keys are accumulating.

I would appreciate advice on how to identify the root cause without risking existing data or configuration.

COMMUNITY RESPONSES

Verified community troubleshooting

0 replies

No answers yet..

Showing 0 of 0 community responses
AI DIAGNOSTICS

Incident analysis

Updated 3w ago• Trouble ID

Most likely causes

Allocator fragmentation retains freed pages rather than immediately returning them to the OS. 87%
A recent software, firmware or configuration change is exposing an existing compatibility issue. 41%

Summary

The reported behaviour is consistent with allocator fragmentation retains freed pages rather than immediately returning them to the OS. The safest next step is to verify that hypothesis with a reversible test before making permanent configuration changes.

Suggested Fixes

Verify the likely cause
Compare used_memory and used_memory_rss, enable active defragmentation when appropriate and set a tested maxmemory eviction policy.
Validate and monitor
Reproduce the issue once after the change, review relevant logs or metrics, and keep a rollback path until the system has remained stable.