Why do we even need consistent hashing?
- Read about it here
- Consistent hashing mitigates the problem
How does consistent hashing work?
Basic working of consistent hashing
Impact of re-sizing the server pool
- When the server pool is re-sized, only keys need to be remapped on average, where is the number of keys, and is the number of slots (servers)
Impact of adding a server
- Assume that a new server
server 4is added, onlykey 0will require redistribution.
Impact of removing a server
- Assume that
server 1is removed, thenkey 1must be remapped toserver 2. Rest of the keys are unaffected.
![]()
Problems with consistent hashing
Problems with consistent hashing - non-uniform key and server distribution
Solution
Virtual nodes in consistent hashing
Benefits of using consistent hashing
- Minimal data redistribution when server pool is re-sized, as demonstrated by adding and removing servers
- Mitigates hotspot (celebrity) problem by distributing data more evenly.