⚡ AlgoZen_
~/home/modern_&_system_design/consistent_hashing2 / 2

Consistent Hashing

Advanced

Maps both servers and keys onto a virtual ring. Each key is assigned to the nearest server clockwise. Adding/removing a server only redistributes a small fraction of keys.

time:O(log n)
space:O(n)
⚡ +400_XP
step[1/10]
> Start
Server A
0
Server B
85
Server C
170
pos 255
255
Consistent Hashing: map servers and keys onto a virtual ring (0-255). Each key goes to the first server clockwise.

// tap NEXT STEP to walk through one step at a time