System Design Patterns: From Fundamentals to Real Systems
0% completed
Consistent Hashing
1. The Incident
The sharding design works with four shards keyed by hash(customer_id) % 4, each handling 625 writes per second; two years later, traffic growth requires a fifth shard.
You change the routing rule from % 4 to % 5, where the percent sign applies modulo and keeps the remainder after division. Before deployment, the team calculates the effect of this small edit. A key remains on its current shard only when hash % 4 equals hash % 5, which happens for just 20% of random hashes
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%