System Design: Walkthroughs
Five systems, decided one decision at a time
A link shortener, a feed, a chat, a rate limiter and a file store — not narrated, but taken apart into the decisions inside them. Every one states its constraints and has an answer: how long the code must be, what a post costs to fan out, which request the limiter refuses, what the sender sees when an ack is lost.
- Modules
- 5
- Drills
- 3
- Build steps
- 0
- Time
- ~4h
Walk out able to
Run three rate limiters over one arrival list and say which request each refuses — and price a fan-out before choosing one.
What you decide
Key spaces, sized
How short a code can be, and where it comes from.
Fan-out, priced
What one post costs on write, and on read.
Limits, to the request
Which one the bucket refuses, and exactly when.
Failure, from outside
What the sender sees when an ack goes missing.
The pitch
What you practise, and what you leave with
Not an artifact — a reflex: every decision inside a named system arrives with its number attached instead of as a preference.
You will practise
- Size a code space and pick where ids come from
- Price fan-out on write against fan-out on read
- Run three rate limiters over one arrival list
- Cost a failed upload and a content-addressed store
Afterwards you can
- Say which request each limiter refuses, and when
- Derive a fan-out threshold instead of quoting one
- Say what the sender sees when an ack is lost
- Review a whole design with three numbers
Modules
5 modules, 23 items
Lessons explain one idea. Drills repeat it until it sticks. Build steps make something that exists afterwards.
- 1
Shorten a URL
~42 minSize a code space, let a constraint pick the id scheme, and keep the click data.
- LessonDecide how long the code is13 min
- LessonName the four places a code comes from6 min
- LessonLet the constraint pick the scheme10 min
- LessonDecide whether one machine holds it5 min
- LessonServe the redirect and keep the data8 min
- 2
Build the feed
~44 minPrice both fan-out paths, derive the threshold between them, and page a moving list.
- LessonPrice one post on the write path7 min
- LessonMove the work to the read path9 min
- LessonDerive the threshold, do not quote it12 min
- LessonPage a list that is being written to9 min
- LessonSwap the offset for a cursor7 min
- 3
Deliver a message
~37 minKeep a conversation ordered, make a resend safe, and say what the sender sees.
- LessonNarrow the ordering promise6 min
- LessonFind where the ordering stops9 min
- LessonMake the resend safe12 min
- DrillSay what the sender sees10 min
- 4
Hold the line
~1hRun three limiters over the same arrivals, and place the counter where it works.
- LessonSpend a token bucket14 min
- DrillCount a sliding window12 min
- LessonEstimate without keeping the log13 min
- LessonFind where two limiters disagree14 min
- LessonPut the counter somewhere12 min
- DrillPay for the retry9 min
- 5
Store the file
~44 minCost a failed upload, count what a block store holds, then review one whole design.
- LessonSplit the upload and resume it13 min
- LessonStore each block once13 min
- LessonReview one design end to end18 min
More in Algorithms & interviews
Keep going
Discrete Mathematics Drills
MA101 taught it once. This is the volume.
Intermediate~8h8 modules
Interview: Two Pointers & Sliding Window
Read the problem. Then say whether a window applies at all.
Intermediate~3h4 modules
Interview: Trees & Graphs
One skeleton. Then the family it answers.
Intermediate~5h6 modules
Interview: Dynamic Programming
Most problems are not new. Learn to see the shape.
Advanced~5h5 modules
The system is the setting. The decisions are the work.
The first item is free. ~4h of focused work, at your own pace.
Advanced~4h5 modules