Consistent Hashing: The Ring, the Algorithm, and Why It Wins

Hands-on practice for this lecture. Work through the exercises and quizzes to reinforce what you've learned.

1

Exercise 1 of 1

Route the Request — Consistent Hashing Ring

Given a sorted ring with 4 servers and k=3 virtual nodes each, find the correct server for 5 different user hash values using the clockwise upper-bound rule.

Route each user to the correct server

Sorted ring  Â·  4 servers (A B C D)  Â·  k = 3 virtual nodes each

3
B
12
C
17
B
20
D
23
A
30
D
40
A
55
C
63
D
81
A
87
C
99
B

Rule: walk clockwise (right) from the user's hash position → first server you hit handles the request. Wrap to index 0 if you reach the end.

User  hash = 5 â†’ routes to?
User  hash = 25 â†’ routes to?
User  hash = 45 â†’ routes to?
User  hash = 65 â†’ routes to?
User  hash = 90 â†’ routes to?

Each server appears 3 times in the ring (k = 3 virtual nodes). Finding the next entry clockwise is equivalent to a binary search for the upper bound in the sorted array.

Practice: Consistent Hashing: The Ring, the Algorithm, and Why It Wins — Interactive Exercises | Durgesh Rai