Why this matters
- VaultCommerce expanded its Redis cluster from 4 to 8 nodes during Diwali traffic; consistent hashing kept cache hit ratio above 85% through the rollout.
- Shard rebalancing without consistent hashing causes overnight cache miss storms and database overload.
- Interviews ask you to explain the ring, virtual nodes, and why hash tags matter in Redis Cluster.
The modulo hashing problem
3 cache nodes, key "cart:user_42"
slot = hash("cart:user_42") % 3 → node 1
Add a 4th node:
slot = hash("cart:user_42") % 4 → node 2 ← MOVED
When most keys remap, VaultCommerce's product API would hammer Postgres until caches refill — a cache stampede visible to shoppers as 3-second page loads.
The hash ring
Node A0°–120°
Node B120°–240°
Node C240°–360°
Key Klands on B
Ring mechanics
- Hash space forms a fixed ring (0 to 2³²−1).
- Each node occupies one or more positions (virtual nodes).
- Each key hashes to a position on the ring.
- Walk clockwise from the key — the first node encountered owns it.
- Adding a node steals only keys between its predecessor and itself (~1/N keys).
Only keys in the affected arc migrate. The rest stay put — preserving warmth in the cache.
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 3 sections
- Virtual nodes for even distribution
- Redis Cluster hash tags
- Rebalancing in production
Test yourself
Answer these before moving on — recall is what makes it stick.