BuildSeniorBackendAuto-graded
Stop a hash ring from reshuffling every key
Exposes whether someone knows the simple way of spreading work across servers falls apart when a server is added.A hash ring exists so that adding or removing a node remaps only a small slice of the keys, letting a cluster grow and shrink without reshuffling every cache entry or shard. TheHashRing in ring.py does not deliver that: it falls back on plain modulo hashing, so changing the node count moves nearly every key. Fix the ring so membership changes are cheap, the distribution stays balanced, and the mapping is stable across processes.45 min
python
You're done when
- The mapping is deterministic across separate processes — the same key resolves to the same node everywhere, not just within one run.
- Removing a node moves only the keys that belonged to that node, leaving the rest untouched.
What it measures
Data structures and algorithmsBuilding a hash ring with virtual nodes so that ownership changes stay local to the node that changed.
Distributed data processingUnderstanding why modulo hashing is fatal to a cluster that resizes, and what consistent hashing buys instead.
Cross-process determinismSpotting that a per-process hash seed makes a ring unusable in a real deployment, however correct it looks in one process.
Your environment
Terminal + editorA full shell in the browser
Claude CodePre-authenticated, no key setup
Isolated microVMYours alone, wiped afterwards
Start this lab
45 min
Start labYou'll sign in to Anthropos to start. The lab opens in a private cloud workspace with Claude Code ready to use.AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo