Documentation Index
Fetch the complete documentation index at: https://mintlify.com/redis/redis/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Redis provides powerful built-in monitoring capabilities to track server health, performance metrics, and command execution. This guide covers the INFO, MONITOR, and SLOWLOG commands.INFO Command
The INFO command returns comprehensive information about the Redis server.Basic Usage
INFO Sections
Server Section
Basic server information:redis_version- Redis server versionredis_mode- standalone, cluster, or sentinelos- Operating systemarch_bits- Architecture (32 or 64 bit)process_id- Server process PIDtcp_port- TCP portuptime_in_seconds- Server uptimeuptime_in_days- Server uptime in daysconfig_file- Configuration file path
Clients Section
Client connection information:connected_clients- Number of connected clientscluster_connections- Number of cluster connectionsmaxclients- Maximum client limitclient_recent_max_input_buffer- Biggest input bufferclient_recent_max_output_buffer- Biggest output bufferblocked_clients- Clients blocked on BLPOP, BRPOP, etc.tracking_clients- Clients with tracking enabledclients_in_timeout_table- Clients in timeout table
Memory Section
Memory usage statistics:used_memory- Total memory allocated by Redis (bytes)used_memory_human- Human readable formatused_memory_rss- Resident set size from OS perspectiveused_memory_peak- Peak memory consumedused_memory_peak_human- Peak memory (human readable)used_memory_overhead- Server overhead memoryused_memory_dataset- Dataset memory (excluding overhead)used_memory_dataset_perc- Dataset memory percentagetotal_system_memory- Total system memorytotal_system_memory_human- Total system memory (human readable)maxmemory- Configured maxmemory limitmaxmemory_human- Maxmemory (human readable)maxmemory_policy- Eviction policymem_fragmentation_ratio- Fragmentation ratio (RSS/allocated)mem_allocator- Memory allocator (jemalloc, libc, tcmalloc)
- used_memory: Total memory Redis reports as used
- used_memory_rss: Actual physical memory used (from OS)
- Fragmentation ratio:
used_memory_rss / used_memory- < 1.0: Redis is swapping (bad!)
- ~1.0: Ideal
- > 1.5: High fragmentation, consider restart
Stats Section
General statistics:total_connections_received- Total accepted connectionstotal_commands_processed- Total commands processedinstantaneous_ops_per_sec- Operations per secondtotal_net_input_bytes- Total bytes receivedtotal_net_output_bytes- Total bytes sentinstantaneous_input_kbps- Input kilobytes per secondinstantaneous_output_kbps- Output kilobytes per secondrejected_connections- Rejected connections (maxclients)expired_keys- Total keys expiredevicted_keys- Total keys evictedkeyspace_hits- Successful key lookupskeyspace_misses- Failed key lookupspubsub_channels- Active pub/sub channelspubsub_patterns- Active pub/sub patterns
- Keys expiring too quickly
- Insufficient memory causing evictions
- Application requesting non-existent keys
Replication Section
Replication information:role- master or slaveconnected_slaves- Number of connected replicasmaster_replid- Replication IDmaster_repl_offset- Master replication offsetrepl_backlog_active- Backlog statusrepl_backlog_size- Backlog buffer size
master_host- Master hostmaster_port- Master portmaster_link_status- up or downmaster_last_io_seconds_ago- Seconds since last master IOmaster_sync_in_progress- Sync status
CPU Section
CPU consumption:used_cpu_sys- System CPU consumed by Redisused_cpu_user- User CPU consumed by Redisused_cpu_sys_children- System CPU by background processesused_cpu_user_children- User CPU by background processes
Keyspace Section
Database key statistics:keys- Total keysexpires- Keys with expiration setavg_ttl- Average TTL in milliseconds
Persistence Section
RDB and AOF status:loading- 1 if loading dataset, 0 otherwiserdb_changes_since_last_save- Changes since last RDBrdb_bgsave_in_progress- 1 if BGSAVE in progressrdb_last_save_time- Unix timestamp of last successful saverdb_last_bgsave_status- ok or errrdb_last_bgsave_time_sec- Duration of last BGSAVEaof_enabled- AOF statusaof_rewrite_in_progress- 1 if AOF rewrite in progressaof_last_rewrite_time_sec- Duration of last rewriteaof_current_size- Current AOF sizeaof_base_size- AOF size at last rewrite
Commandstats Section
Per-command statistics:calls- Number of times calledusec- Total microseconds consumedusec_per_call- Average microseconds per callrejected_calls- Number of rejected callsfailed_calls- Number of failed calls
Monitoring with INFO
Key Metrics to Monitor
MONITOR Command
MONITOR streams all commands processed by the Redis server in real-time.Basic Usage
Use Cases
Debug Application Issues
See exactly what commands your application sends:Identify Performance Problems
Find slow or problematic queries:Audit Commands
Track who’s accessing what:MONITOR Best Practices
- Use only for short debugging sessions
- Avoid on production servers under load
- Pipe output to
headorgrepto limit data - Consider SLOWLOG for production monitoring instead
SLOWLOG Command
SLOWLOG tracks queries exceeding a specified execution time threshold.Configuration
SLOWLOG Subcommands
SLOWLOG GET
Retrieve slow log entries:- Unique ID (monotonically increasing)
- Unix timestamp when command was executed
- Execution time in microseconds
- Array of command and arguments
- Client IP and port
- Client name (if set with CLIENT SETNAME)
SLOWLOG LEN
Get number of entries:SLOWLOG RESET
Clear the slow log:Analyzing Slow Queries
Identify Common Slow Patterns
Monitor Slow Queries Continuously
Common Slow Commands
Commands that often appear in SLOWLOG: KEYS PatternSCAN instead
Large Collection Operations
Latency Monitoring
Redis provides latency monitoring for various events:Monitoring Best Practices
#!/bin/bash
# redis-health-check.sh
# Check if Redis is running
if ! redis-cli ping > /dev/null 2>&1; then
echo "CRITICAL: Redis is down"
exit 2
fi
# Check memory usage
MEM_USAGE=$(redis-cli INFO memory | grep used_memory_human | cut -d: -f2)
echo "Memory usage: $MEM_USAGE"
# Check connected clients
CLIENTS=$(redis-cli INFO clients | grep connected_clients | cut -d: -f2)
echo "Connected clients: $CLIENTS"
# Check operations per second
OPS=$(redis-cli INFO stats | grep instantaneous_ops_per_sec | cut -d: -f2)
echo "Ops/sec: $OPS"
Monitoring Checklist
- Configure appropriate slowlog threshold
- Set up INFO-based health checks
- Monitor memory usage and fragmentation
- Track operations per second
- Monitor cache hit rate
- Check replication status (if using replicas)
- Review slow log regularly
- Set up alerting for critical metrics
- Monitor persistence operations (BGSAVE/AOF)
- Track client connections
- Enable latency monitoring
- Integrate with external monitoring tools