Design a Distributed Cache
System Design Cases: lesson 15 of 20
A ring of machines where losing one moves only its own arc.
Lesson 15 of 20 · 7 min
Design a Distributed Cache
Step 1 of 11
One working set, too large for a single box, spread over machines arranged as a ring.
The Idea
Spread one hot working set over twenty machines and keep the map steady when a machine dies. Assume reads dominate, the data fits nowhere near one box, and a miss is expensive rather than fatal.
Real-World Example
Lockers arranged in a circle with an attendant beside each one. Every bag goes to the attendant standing clockwise of where it lands, so one attendant leaving shifts only the bags in their own stretch.
The Tradeoff
Hashing keys onto a ring moves a single node's share when a node joins or leaves, instead of remapping everything, and leaves load lumpy until each machine is scattered across the ring as many virtual points. Eviction is the other half of the design: a TTL bounds staleness, and least-recently-used decides who leaves when memory runs out.
Your turn
Put the steps in the right order.
- Store the value on that node and evict the least recently used entry if it is full
- Hash the key onto the ring and walk clockwise to the owning node
- Read from the origin store on a miss
- Ask that node for the key
Mini quiz
1 / 3