Redis Cloud databases enforce a configured memory limit. When usage approaches that limit, Redis must evict keys or reject writes. This article provides step-by-step diagnostics, short-term mitigation strategies, and long-term architectural fixes to resolve sustained memory pressure.
For warning interpretation and decision guidance, see High Memory Usage Warning in Redis Cloud: What It Means and What to Do Next.
Quick Diagnostic Checklist
Confirm utilization and trend
Redis Cloud Console → Database → Metrics
Review:
Used memory vs limit
Growth trend
Evictions
OOM errors
Optional CLI:
INFO memoryFocus on:
used_memory
maxmemory
evicted_keys
mem_fragmentation_ratio
Identify Large Keys
Sample large keys:
redis-cli --bigkeysLarge hashes, lists, sorted sets, streams, or JSON documents are common causes.
Unbounded collections are high-risk patterns.
Check Slow Commands
slowlog get 200Look for:
KEYS
Full scans
HGETALL or LRANGE 0 -1 on large structures
JSON.GET on entire large documents
Memory pressure and latency frequently correlate.
Inspect Index Overhead
If using Search or JSON:
FT.INFO <index>Review:
num_docs
Schema fields
SORTABLE fields
Unnecessary TEXT fields
Common issues:
Indexing fields not queried
Overuse of TEXT instead of TAG
Missing NOINDEX for non-searchable fields
Indexes can consume significant RAM.
Short-Term Mitigation
Delete Unused Data
Use SCAN and UNLINK, not KEYS and DEL.
Example pattern-based cleanup:
--scan --pattern 'prefix:*'
UNLINKAvoid blocking deletions in production.
Tighten TTL Policies
Ensure cache keys have expiration.
Refactor unbounded structures into time-bucketed keys with TTL.
Increase Database Size
If workload is legitimate and persistent, increase database size in the Redis Cloud Console.
Maintain headroom above peak expected usage.
Long-Term Fixes
Enforce Data Lifecycle
Define retention per data type:
TTL
Archival
Cleanup jobs
Refactor Large Structures
Avoid:
Infinite logs in lists or streams
Ever-growing hashes
Massive single JSON documents
Use:
Time buckets
Trimming
Key sharding
Optimize Index Schemas
Index only searchable fields
Avoid unnecessary SORTABLE
Use TAG for categorical fields
Scope indexes using PREFIX
Rebuild carefully and measure before and after.
Scale Horizontally
If growth is real and sustained:
Increase memory
Enable clustering
Ensure cluster-aware clients
Monitoring Best Practices
Track:
used_memory vs maxmemory
evicted_keys
OOM errors
Latency percentiles
Recommended alerts:
Warning at 75 to 80 percent
Critical at 90 percent
Immediate alert on OOM
Summary
High memory pressure in Redis Cloud is typically caused by one or more of:
Unbounded data growth
Missing TTL policies
Oversized keys
Over-indexed datasets
Legitimate, sustained growth without scaling
Durable resolution requires lifecycle enforcement, schema optimization, and right-sizing capacity.
0 comments
Please sign in to leave a comment.