The app is slow and Redis is the suspect. Now what?
The failures to plan for, and the playbook from symptom to fix.
| What happens | What you see | What I do |
|---|---|---|
| A big key | One DEL or HGETALL on a hash with millions of fields blocks every client for hundreds of milliseconds | Find it with redis-cli --bigkeys and MEMORY USAGE. Split it into smaller keys. Delete big keys with UNLINK, which frees memory in the background. |
| A hot key | One shard at 100% CPU while the others idle | A key lives on one shard and one thread. Spread it over several keys, or count in the application and write once a second. |
| KEYS * or a long Lua script in production | Everything stalls while it runs; SLOWLOG fills up | SCAN instead of KEYS. Keep scripts short. |
| Memory full | With noeviction, writes fail with an OOM error. With an eviction policy, keys quietly disappear | Set maxmemory and a policy that matches the job. Alert well before the limit. |
| A fork on a big, busy instance | Latency spikes during snapshots and AOF rewrites; memory jumps; sometimes the out-of-memory killer | Leave memory headroom, turn off transparent huge pages, and take snapshots on a replica. |
| A replica that keeps falling behind | Full resync loops: fork, copy everything, fall behind again | A bigger repl-backlog-size and client-output-buffer-limit for replicas. |
| Failover with asynchronous replication | The newest writes, already acknowledged, are missing after a replica is promoted | Keep only data you can rebuild in Redis, or accept and document the window. |
How do databases actually work? From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.