Plainnotes

What happens when Redis runs out of memory

2025-07-16 · 2 min readDeploy

At maxmemory, behaviour is entirely maxmemory-policy, and the default is noeviction: writes fail with OOM command not allowed while reads keep working.

For a cache, use allkeys-lru or allkeys-lfu. Two caveats: the volatile-* policies only evict keys with a TTL, so a keyspace without TTLs never evicts; and eviction is approximate, sampling maxmemory-samples keys rather than tracking exact LRU.

With RDB persistence, fork copies page tables and memory can briefly double, so leave headroom under maxmemory.

If Redis is a database rather than a cache, noeviction is correct — but monitor and alert at 80%, or failed writes reach users directly.