Back to results for “Monitoring”
Redis › Redis Performance Tuning & Benchmarking

What common commands and usage patterns should generally be avoided because they can cause performance problems on a large Redis dataset?

Intermediate

Answer

You should avoid the KEYS command in favor of SCAN, avoid retrieving an entire very large collection at once when only a portion is actually needed, avoid storing extremely large individual values that take a long time to transfer and process, and avoid running expensive operations like sorting a huge collection frequently without caching the result.
-- Avoid on a large dataset
KEYS *

-- Prefer this instead
SCAN 0 COUNT 100
Real-world example A team notices periodic latency spikes correlate exactly with a monitoring script's scheduled run, discovering it was using KEYS on a large production dataset, and fixes the issue by switching it to SCAN.

Common follow-ups: What other Redis commands have similar performance characteristics to KEYS that should be used carefully?;How do you identify which specific commands are causing performance issues in your application?