Redis does not crash when memory is full. You configured what happens next.

Hit maxmemory and Redis evicts or rejects writes. It does not vanish. The process the OS kills is usually the one you never capped.

Redis does not crash when memory is full. You configured what happens next.

Interview question: Redis holds data in RAM. What happens when RAM runs out?

People say it crashes. That is the OS story, not the Redis story — and only if you never set a limit.

If maxmemory is set

You hit the cap you chose.

Then Redis follows the eviction policy you chose. allkeys-lru drops least-recently-used keys. allkeys-lfu prefers keys that are rarely used — closer to “keep the hot set.” noeviction means: do not drop keys to make room.

If nothing can be evicted, new writes fail (out of memory on that write). Existing keys can still be read. The process is up. Your cache is just refusing to grow.

That is a degraded cache, not a dead one.

If maxmemory is not set

Redis will keep allocating until the machine has nothing left.

Then the Linux OOM killer may shoot the process. That looks like “Redis crashed.” The failure started when nobody capped it.

What to do in production

- Set maxmemory to a number the box can actually spare.
- Put TTL on data that is allowed to disappear.
- Pick eviction for how you use Redis: LRU for a general cache, LFU when a small hot set matters.
- Do not treat Redis as an unbounded database.

Hashes for many tiny related fields can use less memory than thousands of tiny string keys. That is a packing trick, not a substitute for a cap.

Takeaway

Full memory is a policy decision.

Cap it, expire what is temporary, choose eviction on purpose.

The surprise crash is almost always the instance with no maxmemory.