Interview › Databases & Caching
What is the impact of a large key or hot key in Redis, and how do you handle it?
Databases & Caching · Advanced level
Answer
A large key increases memory, network, replication, and latency cost; a hot key concentrates too much traffic on one key or shard. I handle them by splitting keys, redesigning data structures, local caching, and request coalescing.
Technical explanation
Large keys increase memory, network, replication, and command latency cost.
Hot keys overload one shard or event loop even if total cluster capacity looks healthy.
Fixes include splitting keys, better data structures, local cache, key sharding, and request coalescing.
Hands-on example
Investigation:
redis-cli --bigkeys -h <host> -p 6379
SCAN 0 MATCH product:* COUNT 1000
MEMORY USAGE product:v2:123Avoid KEYS in production.
Preparing for an interview?
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Databases & Caching interview questions
- Why are some Redis commands (KEYS, FLUSHALL) dangerous in production?
- What is a cache hit ratio, and how do you improve it?
- How does ElastiCache provide high availability and automatic failover?
- What is the difference between Redis as a cache and Redis as a primary datastore?
- What is the difference between Redis Sentinel and Redis Cluster?
- How would you use Redis for rate limiting?
- What is Redis Cluster, and how does sharding with hash slots work?
- How would you use Redis for distributed locking, and what are the caveats?