Consistent Hashing Ring

hard
Unit 24 · Heaps0/2 to milestone

Spread keys across cache servers with hash(key) % n_servers and adding one server remaps almost every key. Consistent hashing places servers and keys on a ring, so adding or removing a server only moves about 1/n1/n of the keys.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Consistent Hashing Ring · TechGradify