Core Concept

Consistent Hashing

Consistent hashing minimizes data remapping when scaling node pools, making it the bedrock of elastic distributed caches and databases.


What:

Consistent hashing is a specialized hashing topology where resizing the server partition array only requires remapping 1/N of the keys on average.

Primary purpose:

Preventing massive data rebalancing cascades and cache invalidation storms when nodes scale up or down.

Usually used for:

Distributed caches, DynamoDB-style databases, and stateful reverse proxies.

How should I think about this inside system architectures?

⭕ The Shared Ring Space

Map both physical servers and keys onto the exact same circular hash ring (from 0 to 2^64 - 1).

🧭 Clockwise Ownership

A key is assigned to the first server encountered moving clockwise. Removing a node only shifts its immediate segment.

🎭 Virtual Node Spans

Deploy 100-200 virtual points per physical machine to distribute keys uniformly across the ring.