AWS ElastiCache Support
ElastiCache Redis memory and eviction troubleshooting.
When ElastiCache runs out of memory, Redis either evicts keys or rejects writes with an OOM command not allowed error, depending on the eviction policy. The cause is usually missing TTLs, oversized keys or fragmentation, not too small a node. We find the cause before we scale.
When You Need This
The situations where this work pays for itself.
Signs it is time
- Writes fail with OOM command not allowed when used memory > maxmemory
- The Evictions metric is climbing and the hit rate is falling
- Memory use grows without bound over weeks
- The node uses swap or latency spikes during snapshots
- You are choosing a node size and do not know your working set
What you get
- Memory analysis with big-key and no-TTL findings
- Eviction policy and parameter group changes
- Application changes for TTLs and value size
- Alarms on memory, evictions and swap
How we do it
A clear, safe process you can follow along with.
1. Read the memory metrics
We chart DatabaseMemoryUsagePercentage, BytesUsedForCache, Evictions, CurrItems, SwapUsage and CacheHitRate to see whether memory is full, growing or fragmenting.
2. Check the eviction policy
The default policy depends on the setup. volatile-lru evicts only keys with a TTL, so if few keys have TTLs it cannot free memory and writes fail. allkeys-lru evicts any key. We choose the policy to match whether the data is a pure cache.
3. Find large and non-expiring keys
We sample the keyspace with SCAN-based tools or redis-cli --bigkeys and memory usage commands, avoiding KEYS on production. We look for huge hashes, lists and sets and for keys with no TTL.
4. Add TTLs and reduce size
We set TTLs with jitter, use compact data structures, compress large values, and shorten key names if they are a real fraction of memory.
5. Allow headroom for snapshots and replication
Backups and replication use extra memory. We tune reserved-memory-percent and avoid running near full on nodes that snapshot.
6. Scale correctly
If the working set truly exceeds memory, we move to a larger node, add shards in cluster mode, or consider data tiering node types if the pattern fits.
Mistakes we help you avoid
Common ways this goes wrong, and what we do instead.
Scaling up before finding leaks
Keys without TTLs fill any size of node eventually.
Using KEYS or full scans on production
They block Redis. Use SCAN with small batches.
Choosing volatile-lru for keys with no TTL
Nothing is eligible for eviction, so writes fail.
Frequently Asked Questions
What does OOM command not allowed when used memory is greater than maxmemory mean?
Redis reached its memory limit and the eviction policy cannot free space, so it rejects writes. Add TTLs, change the policy or add memory.
Should I worry about Evictions on a cache?
Some evictions are normal for a cache. A rising count with a falling hit rate means the working set no longer fits and you are losing cache benefit.
Why does Redis use more memory than my data size?
Overhead from data structures, fragmentation, buffers and copy-on-write during snapshots adds to data size. Keep headroom beyond your dataset.
Want Help With ElastiCache Redis memory and eviction troubleshooting?
Schedule an appointment. Tell us about your environment and we will outline the safest, highest-value approach.
Schedule Appointment › No commitment required