1.1 KiB
1.1 KiB
| title | impact | impactDescription | tags | description | alwaysApply |
|---|---|---|---|---|---|
| Use Observability Commands for Debugging | MEDIUM | Enables quick diagnosis of performance issues | observability, slowlog, info, memory, debugging | Use Observability Commands for Debugging | true |
Use Observability Commands for Debugging
Redis provides built-in commands for monitoring and debugging.
Key commands:
# Slow query log - find slow commands
SLOWLOG GET 10
SLOWLOG LEN
SLOWLOG RESET
# Server info - comprehensive stats
INFO all
INFO memory
INFO stats
INFO replication
INFO clients
# Memory analysis
MEMORY DOCTOR
MEMORY STATS
MEMORY USAGE mykey
# Client connections
CLIENT LIST
CLIENT INFO
# Index info (RQE)
FT.INFO idx:products
FT.PROFILE idx:products SEARCH QUERY "@name:laptop"
Correct: Check SLOWLOG regularly.
# Get recent slow queries
slow_queries = redis.slowlog_get(10)
for query in slow_queries:
print(f"Duration: {query['duration']}μs, Command: {query['command']}")
Reference: Redis Monitoring