What problem does consistent hashing solve in distributed systems?
Consistent hashing: with naive hash(key) % N, changing N remaps almost every key. Consistent hashing places nodes and keys on a ring so adding or removing a node only relocates a small fraction of keys.
2 / 5
What is the hash ring in consistent hashing?
Hash ring: the hash output space is treated as a circle. Nodes are placed at points around it, and each key is assigned to the first node found going clockwise from the key's position.
3 / 5
Why are virtual nodes used in consistent hashing?
Virtual nodes: with few nodes, the ring distributes keys unevenly. Assigning each physical node multiple virtual positions smooths the distribution so load is balanced and node removal spreads keys to many others.
4 / 5
When a node is removed from a consistent hash ring, what happens to its keys?
Node removal: the departed node's keys are reassigned to the next node on the ring. Keys belonging to other nodes stay put, which is the core efficiency advantage over modulo hashing.
5 / 5
Where is consistent hashing commonly applied?
Applications: systems such as memcached clients, Cassandra, and DynamoDB use consistent hashing to spread data across nodes so scaling the cluster up or down causes minimal data movement.