How-to guide
Redis monitoring: metrics that matter
Redis is fast until it runs out of memory, starts evicting the wrong keys or blocks on a slow command. INFO tells you almost everything you need.
4 min read13 sectionsUpdated
On this page
redis-cli INFO memory | grep -E 'used_memory_human|maxmemory_human|mem_fragmentation_ratio'
redis-cli INFO stats | grep -E 'keyspace_hits|keyspace_misses|evicted_keys|instantaneous_ops_per_sec|rejected_connections'
redis-cli INFO clients | grep -E 'connected_clients|blocked_clients'
redis-cli INFO persistence | grep -E 'rdb_last_bgsave_status|aof_last_write_status'
redis-cli INFO replication | grep -E 'role|connected_slaves|master_link_status'
redis-cli SLOWLOG GET 10
redis-cli --latency -i 1| Metric | Healthy | Worry when |
|---|---|---|
| used_memory / maxmemory | Comfortable headroom | Above 85 to 90% |
| evicted_keys | Zero for data stores; steady for caches | Climbing fast, or any for a primary store |
| Hit rate = hits ÷ (hits + misses) | High for a cache (often above 90%) | Dropping after a deploy |
| mem_fragmentation_ratio | Around 1.0 to 1.5 | Well above 1.5, or below 1 (swapping) |
| connected_clients | Stable | Near maxclients; rejected_connections rising |
| master_link_status | up | down on a replica |
In VitalRix
A ready-made Redis check sends PING or reads INFO and compares fields you choose, such as memory or replication status, on a schedule. Redis client spans in APM traces show which requests wait on Redis and for how long. See synthetic monitoring.
A typical Redis incident
Latency on the product API doubles at 11:00. Traces show Redis calls taking 300 ms instead of 1 ms. SLOWLOG reveals a new admin job running KEYS session:* every minute against 4 million keys, blocking every other client while it scans. The fix: replace KEYS with SCAN in batches, run the job against a replica, and add an alert on Redis command time from traces so the next blocking command is caught in minutes.
Checklist
- maxmemory set, with an eviction policy that matches the use (cache or store).
- Alerts on memory, evictions, replication link and PING from the app network.
KEYS,FLUSHALLandDEBUGrenamed or disabled in production.- Persistence status checked if Redis holds data you cannot rebuild.
- Client timeouts set, so a stuck Redis does not hang every request.
The Redis metrics that matter
Almost everything comes from INFO; latency comes from the client side and from Redis's own latency tools.
| Metric | INFO field | Starting alert |
|---|---|---|
| Memory vs maxmemory | used_memory, maxmemory | Above 80% of maxmemory |
| Evicted keys | evicted_keys | Any increase on a cache you did not expect to evict, always on a store that must not evict |
| Hit ratio | keyspace_hits / (keyspace_hits + keyspace_misses) | A drop after a deploy or a restart |
| Connected and blocked clients | connected_clients, blocked_clients | Near maxclients, or blocked clients that never clear |
| Memory fragmentation | mem_fragmentation_ratio | Above about 1.5 for a long time |
| Persistence | rdb_last_bgsave_status, aof_last_write_status | Anything other than ok |
| Replication | master_link_status on replicas | down |
redis-cli INFO memory | grep -E 'used_memory_human|maxmemory_human|mem_fragmentation_ratio'
redis-cli INFO stats | grep -E 'keyspace_hits|keyspace_misses|evicted_keys'
# the slowest recent commands, and latency spikes Redis noticed itself
redis-cli SLOWLOG GET 10
redis-cli --latency -i 1What the incidents look like
- "OOM command not allowed" when memory reaches maxmemory with a noeviction policy: see Redis OOM command not allowed.
- Latency spikes from one slow command: KEYS on a large database, a huge LRANGE, or a big DEL. Redis is single-threaded for commands, so one slow call stalls everyone. SLOWLOG shows it; use SCAN and UNLINK instead.
- Background saves fail because the disk is full or fork fails on a memory-tight host, and persistence silently stops.
- The hit ratio collapses after a restart and the database behind the cache takes the full load. Warm the cache or limit the stampede with request coalescing.
Which eviction policy should I use?
For a pure cache, allkeys-lru or allkeys-lfu. For data you cannot lose, noeviction, with alerts long before memory is full.
Why is Redis memory higher than my data?
Overhead per key, fragmentation and replication or AOF buffers. Check mem_fragmentation_ratio and memory usage per key type.
Related reading
- MongoDB monitoring: metrics that matter: Monitor MongoDB: operation rates and latency, slow queries from the profiler, WiredTiger cache, connections, replication lag and oplog window.
- How to monitor Heroku: How to monitor apps on Heroku: H12 timeouts and other router errors, dyno memory (R14), response time, Postgres and Redis add-ons, uptime checks and alerts.
- Python memory usage: find what uses memory: Measure and reduce Python memory usage: RSS vs allocated objects, tracemalloc snapshots, finding leaks in long-running workers.
- RabbitMQ monitoring: queues, consumers and alarms: Monitor RabbitMQ: queue depth and message rates, unacknowledged messages, consumer counts, memory and disk alarms, and connection churn, with commands.
- Java memory usage: heap, metaspace and leaks: Understand Java memory usage: heap, metaspace, threads and direct memory, why RSS exceeds -Xmx, how to size for containers.
- The three pillars of observability: Logs, metrics and traces compared: what each pillar of observability is good at, what it costs, and how to link them so one alert leads to the cause.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.