Consistent hashing, explained with a ring you can draw
Arjun RaoPosted · 1 min read
With hash(key) % n, adding one server moves almost every key. Consistent hashing moves only about 1/n of them.
Put servers and keys on the same ring of hash values. Each key belongs to the first server clockwise from it. Adding a server only takes keys from its clockwise neighbour.
Real systems give each server many virtual nodes on the ring, so load stays even when a server joins or leaves.
Comments