Consistent Hashing
Distributing hashes along a ring to minimize partition remappings when server instances scale.
What you'll learn
- Hash Ring
- Virtual Nodes (VNodes)
- Re-sharding Overhead
TL;DR
Distributing hashes along a ring to minimize partition remappings when server instances scale.
Visual System Topology
Consistent Hashing Ring
Resizing nodes only maps 1/N keys. Minimizes massive database stampedes.
Concept Overview
Consistent Hashing is a dynamic hashing technique used in distributed caches and databases where resizing the server pool only requires remapping a small fraction of keys (1/N), avoiding full-pool cache invalidation.
Key Architectural Pillars
Hash Ring
A logical ring structure (0 to 2^32 - 1) onto which both servers and key hashes are mapped.
Virtual Nodes (VNodes)
Mapping a single physical server to multiple virtual points on the ring to guarantee uniform key distribution.
Re-sharding Overhead
The cost of moving keys around. Under classic hashing (hash(key) % N), changing N invalidates nearly all keys.
