Skip to main content

Consistent Hashing

Difficulty: Medium | Topic #9

What to Learn

Hash ring concept, virtual nodes, how it minimizes data redistribution when nodes join/leave, applications in distributed caches and databases.

Resources

Covered by Problems

ProblemDifficultyLink
Distributed CacheMedium
Live Comments (FB Live)Medium
Top K SystemHard
Ride Sharing (Uber)Hard
Online ChessHard

Key Concepts to Master

  • Hash ring and clockwise key assignment
  • Virtual nodes for even distribution
  • How adding/removing a node affects ~1/N keys instead of all keys
  • Rendezvous hashing as an alternative
  • Real-world use in Cassandra, DynamoDB, and Memcached