Partitioning & Sharding • Consistent HashingHard⏱️ ~3 min
Production Failure Modes: Hotspots, Skew, and Thundering Herds
Even with perfect hash distribution, hot keys can overload a single node. A celebrity user on Twitter generates 1000x more requests than typical users; if that user ID hashes to one server, that server sees 80% of traffic while others idle. Consistent hashing distributes keys uniformly but does not protect against individual key hotspots. Mitigations include bounded load selection (if selected node is above 1.1x mean load, pick next candidate) or hotspot sharding (append random suffix to hot keys, splitting load across multiple nodes).
Membership view drift causes split traffic during topology changes. Client side hashing requires all clients to agree on the node set. During a rolling node addition, clients with old membership send keys to old nodes while updated clients send to new nodes, causing cache misses and inconsistent reads. Amazon Dynamo mitigates this with versioned membership and hinted handoff: if a node receives a key it no longer owns, it temporarily holds it and forwards when the rightful owner is reachable. Meta mcrouter uses monotonic rollouts, adding nodes before removing, and maintains grace periods where nodes accept keys for both old and new assignments.
Thundering herds occur when adding or removing a node remaps hot keys simultaneously. Adding one node to a 100 node cluster remaps 1% of keys; if those include top 1000 hottest keys, the new node and its cache miss backends see a coordinated spike. Production systems mitigate with staged activation (gradually increasing a new node's vnode count over minutes), background warmup (pre-filling cache before directing traffic), and request coalescing (deduplicate simultaneous identical requests).
Small ring anomalies appear when node count or vnode count is too low. With 5 nodes and 10 vnodes per node (50 total positions), random spacing can leave one node owning 30% of keys. Always use minimum 100 vnodes per node, or switch to rendezvous or multiprobe which provide tighter load bounds even with small N. Monitor actual load distribution continuously; alert if any node exceeds 1.2x mean load for more than a few minutes.
💡 Key Takeaways
•Hot key overload: Celebrity user generating 1000x traffic hashes to one node, causing 80% load concentration; bounded load selection (1.1x to 1.2x mean cap) or suffix sharding mitigates
•Membership view drift: During rolling changes, clients with old vs new membership route differently, causing cache miss storms; use versioned membership and hinted handoff (Dynamo) or monotonic rollouts (Meta)
•Thundering herd on remap: Adding one node to 100 node cluster remaps 1% of keys; if hot keys included, new node sees coordinated spike; staged activation over minutes and background warmup mitigate
•Small ring anomalies: 5 nodes with 10 vnodes per node can leave one node owning 30% of keys; always use minimum 100 vnodes per node or switch to rendezvous/multiprobe for small N
•Data movement budget overruns: Adding 10 nodes to 1000 node, 10 PB cluster moves approximately 100 TB (1%); without rate limited streaming, saturates network and violates Service Level Objectives (SLOs)
📌 Examples
Twitter celebrity hotspot: User with 50M followers generates 10K tweets/sec; sharding by tweet ID + random suffix spreads load across 10 cache nodes instead of one
Cassandra node addition: 100 node cluster with 256 vnodes per node; adding one node streams approximately 1% (1 TB from 100 TB dataset) at controlled 100 MB/sec rate over 3 hours
Meta mcrouter membership: Rolling out new cache node with gradual weight increase from 0% to 100% over 10 minutes avoids miss storm; old node continues serving overlapping keys during transition
AWS ElastiCache maintenance: During node replacement, hinted handoff holds misrouted keys temporarily; measured <5% hit rate drop during 2 minute transition window