Difficulty: Beginner
What does the INFO command do in Redis, and which fields do you check when something is wrong?
INFO returns a text report of the Redis server's state and statistics, grouped into sections like server, clients, memory, persistence, stats, replication, cpu and keyspace. It is the first command to run when diagnosing slowness, memory pressure, or replication trouble, and it is what monitoring tools such as the Prometheus redis_exporter scrape under the hood.
INFO returns the default sections.INFO memory returns one section. Since Redis 7.0 you can pass several: INFO memory stats.INFO all adds commandstats, latencystats and errorstats. INFO everything also includes module sections.field:value lines, easy to grep or parse.| Section | Field | What it tells you |
|---|---|---|
| server | redis_version, uptime_in_seconds | Version and whether it restarted recently |
| clients | connected_clients, blocked_clients | Connection leaks, many clients stuck on BLPOP |
| memory | used_memory_human, maxmemory_human | How close you are to the limit |
| memory | mem_fragmentation_ratio | Fragmentation (high) or swapping (below 1) |
| stats | instantaneous_ops_per_sec | Current throughput |
| stats | keyspace_hits, keyspace_misses | Cache hit ratio |
| stats | evicted_keys, expired_keys | Memory pressure and TTL activity |
| stats | rejected_connections | maxclients reached |
| persistence | rdb_last_bgsave_status, aof_last_write_status | Whether saves are failing |
| replication | role, master_link_status, connected_slaves | Replica health and lag |
| keyspace | db0:keys=...,expires=... | Key counts per database |
keyspace_hits / (keyspace_hits + keyspace_misses). A low ratio means bad keys, short TTLs, or eviction. Check whether evicted_keys is climbing.used_memory with maxmemory and look at maxmemory_policy. With noeviction, writes fail once full.used_memory_rss against used_memory and the fragmentation ratio.master_link_status:down or a growing master_last_io_seconds_ago means it is disconnected.INFO commandstats shows calls and microseconds per call per command, so a heavy KEYS or HGETALL stands out. Pair it with SLOWLOG GET.stats are cumulative since start or the last CONFIG RESETSTAT. Graph their rate of change, not the raw value.INFO is cheap and safe to run in production, unlike KEYS or MONITOR.INFO is still the ground truth.role:slave and connected_slaves for compatibility.# Memory and eviction
redis-cli INFO memory | grep -E 'used_memory_human|maxmemory_human|mem_fragmentation_ratio'
# Throughput and cache effectiveness
redis-cli INFO stats | grep -E 'instantaneous_ops_per_sec|keyspace_(hits|misses)|evicted_keys'
# Replication health
redis-cli INFO replication | grep -E 'role|master_link_status|connected_slaves'
# Which commands cost the most time
redis-cli INFO commandstats | sort -t= -k3 -nr | head
Here the hit ratio is about 96%, memory is at about 81% of maxmemory, and there are no evictions yet.
import Redis from 'ioredis';
const redis = new Redis();
const text = await redis.info('stats');
const stats = Object.fromEntries(
text.split('\r\n')
.filter((l) => l && !l.startsWith('#'))
.map((l) => l.split(':'))
);
const hits = Number(stats.keyspace_hits);
const misses = Number(stats.keyspace_misses);
console.log('hit ratio', (hits / (hits + misses)).toFixed(3));
INFO output is CRLF-separated field:value lines with # section headers, so it is easy to parse.
INFO Sections, Memory Metrics, Keyspace Hit Ratio, Replication Status, Monitoring