Pattern 03 / DATA

Consistent Hashing

Use this when redistributing too much data when nodes join or leave a cluster.

Pressure
Redistributing too much data when nodes join or leave a cluster
Mechanism
Place nodes and keys on a hash ring; each key belongs to the next node clockwise, often with virtual nodes
Toll
More complex than modulo hashing and still needs virtual nodes to balance load
Architecture plate03
Diagram for Consistent Hashing
Executive brief

Consistent Hashing fits when redistributing too much data when nodes join or leave a cluster. Mechanism: place nodes and keys on a hash ring; each key belongs to the next node clockwise, often with virtual nodes. Use it for distributed caches, Dynamo-style databases, object storage, and CDN routing. The toll: more complex than modulo hashing and still needs virtual nodes to balance load.

Use when

Distributed caches, dynamo-style databases, object storage, and cdn routing.

Example

Redis cluster adding one cache node with only nearby keys moving.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Data Storage Patterns

01Primary-Replica (Leader-Follower)02Sharding (Horizontal Partitioning)04Write-Ahead Log (WAL)05Event Sourcing06CQRS (Command Query Responsibility Segregation)
โ† 0204 โ†’