Skip to the content.

🔗 Consistent Hashing

Definition:

Consistent hashing is a technique used to distribute data across multiple nodes in a way that minimizes data movement when nodes are added or removed.


1️⃣ Problem it Solves


2️⃣ How It Works

  1. Represent nodes on a hash ring (0–2³² or 0–MAX).
  2. Hash keys to the same ring.
  3. Each key is stored in the first node clockwise from the key’s hash.

Text Diagram:

Hash Ring: 0 --------------------------------- 2^32
Nodes:    N1      N2        N3
Keys:     k1   k2   k3   k4
k1 → N2 (first node clockwise)
k2 → N3
k3 → N1
k4 → N2

3️⃣ Virtual Nodes (VNodes)


4️⃣ Advantages


5️⃣ Use Cases


6️⃣ Analogy

Imagine a circular table (hash ring) where servers sit at different points.


💡 Key takeaway: