redis-cli Diagnostics: INFO, SLOWLOG, MEMORY
Diagnose a live Redis with INFO, SLOWLOG, and MEMORY so you can catch slow commands, memory growth, and eviction pressure before the VPS starts swapping.
Netbay Cloud Team
Netbay Engineering
On this page
When Redis is slow, the application logs lie. They show a timeout, not the KEYS * that caused it. redis-cli is the diagnostic tool that sits on the same host and answers in milliseconds. Three families of commands cover almost every incident on a small VPS: INFO for rates and gauges, SLOWLOG for the commands that blocked the single thread, and MEMORY for why RAM does not match your mental model.
Run them on 127.0.0.1 with the app user or an ACL that can read stats. Do not open 6379 to the internet so a laptop can connect. ssh to the box and use redis-cli there.
INFO is the dashboard
INFO without a section is long. Ask for the section you need.
redis-cli INFO server
redis-cli INFO clients
redis-cli INFO memory
redis-cli INFO stats
redis-cli INFO replication
redis-cli INFO keyspaceOn a standalone VPS the useful lines are these. used_memory_human and maxmemory_human tell you whether eviction or rejected writes are next. instantaneous_ops_per_sec is the current command rate. keyspace_hits and keyspace_misses describe cache quality. evicted_keys rising on a session store is a policy bug. rejected_connections means you hit maxclients. connected_clients growing without bound is a connection leak in the app.
redis-cli INFO stats | grep -E 'ops_per_sec|keyspace_|evicted_|rejected_'
redis-cli INFO memory | grep -E 'used_memory_human|maxmemory_human|fragmentation'
redis-cli INFO clients | grep connected_clientsuptime_in_seconds plus rdb_last_bgsave_status plus aof_last_write_status tell you whether persistence is actually succeeding. last_save that is hours old with save rules enabled means BGSAVE is failing silently if you turned stop-writes-on-bgsave-error off.
INFO commandstats, if you enabled it, ranks commands by calls and usec_per_call. A spike in KEYS or HGETALL usec is the smoking gun for a blocked event loop. Redis is single-threaded for command execution. One slow command delays every other client.
SLOWLOG is the last N expensive commands
SLOWLOG records commands that took longer than slowlog-log-slower-than microseconds. The default is 10 ms. On a cache that should answer in sub-millisecond times, 10 ms is already an incident.
redis-cli CONFIG GET slowlog-log-slower-than
redis-cli CONFIG SET slowlog-log-slower-than 1000
redis-cli SLOWLOG GET 20
redis-cli SLOWLOG LENEach entry has an id, a timestamp, a duration in microseconds, and the command with arguments truncated. Look for KEYS, SORT, full HGETALL on huge hashes, and SUNION of large sets. The fix is almost never "buy more CPU" on Intel Xeon Platinum. The fix is to stop scanning the keyspace. Replace KEYS with SCAN. Replace a giant hash with smaller keys. Add a TTL so cold data leaves.
SLOWLOG is in-memory and capped by slowlog-max-len. It is not a substitute for an exporter. It is the first five minutes of an incident. Reset it with SLOWLOG RESET only after you have copied the entries out.
MEMORY explains the RSS surprise
MEMORY STATS and MEMORY DOCTOR are the next stop when used_memory looks fine and the VPS is still swapping. RSS includes fragmentation, client buffers, and allocator bins.
redis-cli MEMORY STATS
redis-cli MEMORY DOCTOR
redis-cli MEMORY USAGE sess:1a2b3c
redis-cli CLIENT LISTMEMORY USAGE on a hot key shows whether one session blob is 2 KB or 2 MB because someone stuffed a profile photo in JSON. CLIENT LIST shows omem, idle, and flags. A pub/sub client with a large omem is the buffer limit you should have set. MEMORY DOCTOR speaks in sentences; treat it as a hint, then confirm with STATS.
If fragmentation_ratio is high after a large eviction wave, a restart compactifies allocator state. Schedule that restart. Do not hope a rewrite of AOF will fix RSS by itself.
Skip MONITOR on a production port. It streams every command to your terminal and slows the server while you watch. Use SLOWLOG and commandstats instead. LATENCY LATEST and LATENCY HISTORY are the extra pair when INFO looks fine and clients still time out: they show spikes that a one-shot SLOWLOG GET can miss if the slowlog wrapped. Combined with ss -lntp and systemctl status redis-server, that set is enough for a first hour on a Lucknow VPS.
Takeaway
INFO for gauges, SLOWLOG for the blocking command, MEMORY for RSS that does not match used_memory. Keep 6379 on loopback and ssh in. A Netbay Ubuntu instance in Lucknow is enough to practice the three commands — netbayhosts.in.
Keep reading
Follow along on a real VPS
Deploy Linux in under 60 seconds
These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.
Deploy an instance