ReviseAlgo Logo
Intermediate10 min readPerformance & Scaling

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

Keys traverse
Clockwise ↻
Node A (hash: 12)
Node B (hash: 85)
Node C (hash: 198)
K1

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

1

Hash Ring

A logical ring structure (0 to 2^32 - 1) onto which both servers and key hashes are mapped.

2

Virtual Nodes (VNodes)

Mapping a single physical server to multiple virtual points on the ring to guarantee uniform key distribution.

3

Re-sharding Overhead

The cost of moving keys around. Under classic hashing (hash(key) % N), changing N invalidates nearly all keys.

AI Tutor

Ask about the topic

Sign in Required

Please sign in to use the AI tutor

Sign In
Consistent Hashing - Module 4: Performance & Scaling | System Design | Revise Algo