Diagnostics & Slowlog
Because Valkey processes commands on a single main thread (with optional I/O threads for network read/write), even a single slow O(N) command can spike tail latency for every connected client.
Check slow commands (SLOWLOG)#
Configure the slowlog threshold (in microseconds — 10000 = 10ms) in valkey.conf:
slowlog-log-slower-than 10000
slowlog-max-len 256
Read the 20 most recent slow commands:
valkey-cli SLOWLOG GET 20Latency diagnostics#
Run Valkey's built-in latency analyzer and intrinsic latency test:
valkey-cli LATENCY DOCTOR
valkey-cli --intrinsic-latency 10Inspect connected clients & server health#
# Overview of clients, CPU, memory, stats, and replication
valkey-cli INFO clients
valkey-cli INFO stats
# Live stats stream (1-second interval)
valkey-cli --stat -i 1
# List active client connections
valkey-cli CLIENT LISTCommands to avoid in production#
- Avoid
KEYS *— scans the entire keyspace in one blocking call. Use cursor-basedSCANinstead:valkey-cli --scan --pattern "session:*" | head -n 20 - Use
MONITORwith caution — streams every command processed by the server and can cut throughput significantly under high QPS.