Imagine you run a cluster of cache servers and a million requests per second need to find the right one. The naive answer — key mod N — crumbles the moment a server joins or leaves: suddenly almost every key maps to a different node, the cache goes cold, and the origin gets hammered.
The smarter answer is consistent hashing, and its most elegant variant is rendezvous hashing (also called Highest Random Weight, or HRW). First described by David Thaler and Chinya Ravishankar at the University of Michigan in 1996, the idea is almost absurdly simple: for a given key, compute one hash score per server, and send the key to the server with the highest score. No ring structure, no virtual nodes, no coordinator process, no shared state.
When a server is added, only the keys whose scores it now wins move to it — all other assignments are undisturbed. When a server is removed, its keys are redistributed by re-running the same competition among the survivors. In both cases exactly the minimum number of keys moves, which is precisely 1/N of the total (where N is the new server count).
Related reading: load balancing and consistent hashing show the broader landscape of distributed routing tricks.
Comments
Loading comments...