Medium System Design Distributed Systems
How does consistent hashing work and why is it used?
Answer
Consistent hashing distributes data across nodes such that adding/removing nodes minimally affects data distribution. Keys and nodes are mapped to a hash ring; keys are assigned to nearest node clockwise. Adding node: only keys between new node and predecessor remapped. Benefits: minimal redistribution (K/n keys move when node added, K=keys, n=nodes), scalability, load balancing. Virtual nodes: multiple positions per node for even distribution. Used in: distributed caches, databases (DynamoDB), CDNs. Essential for distributed systems.
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Systems Architect Backend Developer