Analyze Redis Memory
Use this skill when Redis memory usage matters: high memory, evictions, or storage optimization.
Workflow
1. Get the overview
info— readused_memory,maxmemory,evicted_keys,expired_keys.dbsize— total key count.- Note whether eviction is actively happening (
evicted_keysgrowing).
2. Profile by type
- Use the server's scan + type tooling to count keys per type (string, hash, list, set, zset, stream). A single type dominating usually points at the culprit pattern.
3. Find the biggest consumers
- Strings: sample long values (
strlenviagetwhen feasible) on the largest keys. - Hashes/lists/sets/zsets: estimate by element count (
hlen,llen,scard,zcard) — element count × element size is the practical proxy; flag keys with extreme counts. - Streams:
xlenfor very long streams with no trimming.
4. Identify candidates
Rank by estimated bytes:
- huge values (large blobs, caches of large payloads),
- unbounded collections (lists/streams that never trim),
- keys with no TTL that should expire (session/cache keys without expiry).
5. Report
Give: memory overview (used/max/evictions), the top N keys by estimated size with their types and element counts, and concrete recommendations (add TTL, trim streams, move blobs out of Redis). Do not delete, expire, or evict anything — those are write actions requiring explicit user intent.