Redis Noeviction Policy OOM Crash
"maxmemory-policy noeviction" seemed safe. No data loss, right?
What happened:
- Redis hit maxmemory limit
- noeviction policy: reject all writes
- Application couldn't write new cache entries
- But it also couldn't write session data
- Users got logged out mid-transaction
- Payment failures spiked 400%
The real problem:
We stored both disposable cache AND critical session data in the same Redis instance with the same eviction policy.
The fix:
- Separate Redis instances for cache vs. sessions
- Cache: allkeys-lru (evict oldest when full)
- Sessions: noeviction + aggressive TTLs + monitoring
- Alerts when memory hits 80%
Lesson: Your eviction policy should match your data's importance. Disposable cache and critical sessions need different strategies.