Consistent Hashing
Add or remove a server and almost nothing should move. Place nodes and keys on a hash ring and watch why only a thin slice of keys shifts, while mod-N reshuffles nearly everything.
Consistent Hashing
Every node and every key gets hashed onto one circle. A key belongs to the first node you meet going clockwise. That single rule is what keeps data put when the cluster grows or shrinks.
With one position per node the arcs are lumpy, so load is uneven. Each virtual node drops another diamond for the same server, slicing the circle into many small arcs that average out.
Why clockwise. Picking the next node clockwise is just a rule everyone agrees on, so any client computes the same owner from the same ring with no coordinator. The direction itself does not matter, only that it is fixed.
Why only a slice moves. A new node lands at one spot and captures only the keys between it and the previous node clockwise. Every key outside that arc still meets the same node it did before, so it stays put. That is the K/N intuition: with N nodes each owns about 1/N of the circle, so a new node steals roughly 1/(N+1) of the keys and leaves the rest alone.
Why virtual nodes. A handful of random points split a circle into wildly uneven arcs, so a few servers get overloaded by luck. Giving each server many positions makes its total ownership the sum of many small arcs, and those averages converge toward an even share. The bar chart flattens as you raise the slider.