Skip to content

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

Key points

  • used_memory against maxmemory is the first number to watch.
  • Evictions and hit rate tell you whether the cache is doing its job.
  • Slow commands block everyone: check SLOWLOG.
  • Persistence and replication matter if Redis holds data you cannot rebuild.

Read INFO

bash
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

What the numbers mean

MetricHealthyWorry when
used_memory / maxmemoryComfortable headroomAbove 85 to 90%
evicted_keysZero for data stores; steady for cachesClimbing 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_ratioAround 1.0 to 1.5Well above 1.5, or below 1 (swapping)
connected_clientsStableNear maxclients; rejected_connections rising
master_link_statusupdown on a replica

Slow commands

Redis runs commands one at a time. A KEYS * on millions of keys, or a huge HGETALL, blocks every other client for its duration. Use SCAN instead of KEYS, keep values small, and check SLOWLOG after latency spikes.

Alerts worth setting

  • Memory above 90% of maxmemory for 5 minutes.
  • Evictions on an instance that is meant to keep all data.
  • Replica link down, or persistence status not ok.
  • Redis not answering PING from your application network.
  • Application p95 rising together with Redis command time in traces.

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, FLUSHALL and DEBUG renamed 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.

MetricINFO fieldStarting alert
Memory vs maxmemoryused_memory, maxmemoryAbove 80% of maxmemory
Evicted keysevicted_keysAny increase on a cache you did not expect to evict, always on a store that must not evict
Hit ratiokeyspace_hits / (keyspace_hits + keyspace_misses)A drop after a deploy or a restart
Connected and blocked clientsconnected_clients, blocked_clientsNear maxclients, or blocked clients that never clear
Memory fragmentationmem_fragmentation_ratioAbove about 1.5 for a long time
Persistencerdb_last_bgsave_status, aof_last_write_statusAnything other than ok
Replicationmaster_link_status on replicasdown
bash
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 1

What 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.

Frequently asked questions

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.

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.