A system design interview asks you to design something like a link shortener in about 45 minutes, out loud, with someone who keeps asking "why?". You've seen only a few building blocks so far, and that's fine: the method doesn't depend on them. Learn it now, and every chapter after this one hands you another box to justify with it.
The shape of 45 minutes
Interviewers aren't looking for one right diagram. They watch how you get to one: whether you pin down the problem before solving it, size it with numbers, and can defend each choice. Most good interviews follow the same arc:
| Phase | Minutes | You come away with |
|---|---|---|
| Requirements | 5 | what the system must do, and how well |
| Estimates | 5 | requests per second, reads to writes, storage |
| API and data model | 5 | the calls and what is stored |
| High-level design | 10 | the boxes and arrows for the main paths |
| Deep dives | 15 | the hard parts, with tradeoffs |
| Wrap-up | 5 | bottlenecks, failures, what you'd do next |
Say which phase you're in. "Before I draw anything, I'd like to pin down the requirements" tells the interviewer you have a plan. The example in this chapter is ink.ly, the link shortener Inkwell's founders want: the most common first question in these interviews.
Requirements first
Functional requirements are what the system does. Non-functional requirements are how well it does it: scale, latency, availability, consistency, durability. The second list decides the design far more than the first.
| ink.ly | |
|---|---|
| Functional | create a short link; redirect a short link; let the owner change where it points |
| Scale | 100 million new links a month; about 100 redirects per link created |
| Latency | redirects feel instant worldwide: tens of milliseconds |
| Consistency | after an edit, the owner lands on the new target |
| Durability | a link that was created is never lost |
| Availability | redirects keep working when a machine fails |
Ask about the parts that change the design: How many users? Read-heavy or write-heavy? Global? How fresh must reads be? What can be lost? Then write the answers down where both of you can see them. The rest of the interview keeps coming back to this table.
Estimates
Turn the requirements into numbers with the arithmetic from Estimation: users × actions ÷ seconds, rounding freely.
| ink.ly | |
|---|---|
| New links | 100 million a month: about 40 a second |
| Redirects | 100 times that: about 4 000 a second, 12 000 at the evening peak, about 3 times the average |
| Storage per link | about 500 bytes |
| Storage over 5 years | 100 million × 60 months × 500 bytes: about 3 TB |
The numbers tell you what matters. 40 writes a second is nothing. 12 000 reads a second is about nine medium app servers before headroom, and more than the roughly 8 000 reads a second one medium database can serve. 3 TB fits on one database, so the data doesn't need splitting for its size. Say it out loud: "the hard part is the redirects at the peak, not the writes." You'll work this chain yourself at the end of the chapter.
API and data model
Name the calls before the boxes:
| Call | Does |
|---|---|
POST /links {url} | creates a link, returns its code |
GET /{code} | redirects to the long URL |
PUT /links/{code} {url} | changes the target, for the owner |
One choice here is a real tradeoff: a 301 (permanent) redirect may be kept by browsers indefinitely, which is fast but means edits and click counts can stop reaching you; a 302 (temporary) redirect isn't kept unless the response says it may be, so the next click sees an edit. The Cache-Control header settles how long either is kept: bit.ly sends a 301 with a max-age of a minute and a half. ink.ly allows edits, so a 302, or a 301 with a short max-age.
Every lookup is by code, and nothing joins or searches across links: code → long URL, owner, created at. One table keyed by code holds it. Later chapters show stores built for exactly this shape; whichever you pick, say why.
High-level design
Start with the simplest boxes that meet the functional requirements, then let the numbers add more. For ink.ly that start is the design from your first chapters:
The first sketch: it creates, redirects and edits links. Now check it against the numbers.
Then hold it against the estimates and say where it breaks. The app servers scale out behind the load balancer. The database can't serve 12 000 redirects a second, and readers on other continents pay the distance on every click. Those two gaps are what the next boxes are for, and each later chapter gives you one: a copy of the hot data in memory, a server near the reader, more copies of the database. A box you can't justify from a requirement or a number is a box to remove.
Deep dives
After the main design, the interviewer picks the hard parts and pushes. For each one, give two or three options, pick one, and say what it costs. Don't defend a choice to the end: if they point out a cost you missed, weigh it and say whether you'd switch.
| They ask | The chapter that answers it |
|---|---|
| How are codes made unique when many servers create them? | Unique IDs |
| A link goes viral | Caching, Hot keys |
| The owner edits a link and lands on the old target | Caching, Replication, Consistency |
| A server dies | Availability |
| Can a created link ever be lost? | Durability |
| Traffic doubles | Scaling Out, Partitioning |
The same few questions come up for almost every system. Each case study at the end of the roadmap runs through them for one product.
Talking about tradeoffs
Every answer has the same shape: I'd choose X, because of requirement Y; it costs Z; if W changed, I'd switch to V.
| Weak | Strong |
|---|---|
| "I'd add more servers." | "12 000 redirects a second at the peak is nine medium app servers flat out; I'd run thirteen, about two-thirds busy at the peak and still under 75% with one down. They share nothing, so doubling traffic means adding servers." |
| "I'd use a big database." | "40 writes a second and 3 TB fit one database. Its problem is the 12 000 reads, so I'd keep one primary and take the reads off it, which I'll come back to." |
| "It's highly available." | "If the one database goes down, nobody can create a link. I'd accept that for now and say what a standby copy would cost." |
Common mistakes: drawing before asking, designing for a scale nobody mentioned, naming a technology without the reason, and never mentioning what happens when something fails.
Using the case studies
The last chapters are whole systems: a news feed, notifications, payments, file sharing, reactions, chat, and ink.ly itself. Each opens with the requirements and the numbers, the way an interviewer would hand them to you. Get more from them by doing each phase yourself before reading on: write the requirements, work the estimates, sketch the boxes, then compare. Time yourself against the 45 minutes, and talk out loud even when you practise alone; the habit of saying the reason with the choice is what the interview tests.
Come back to this chapter before each case study. The phases don't change; only the system does.
Once this chapter is done, every case study can also be tried cold, as a mock interview: open it from Interview practice before you reach its chapter, and you get a one-line brief, questions to put to the interviewer, 45 minutes and one run, then a review against a strong answer. Try ink.ly that way now for a baseline, and again when you reach its chapter. Interview practice also has four mock interviews on paper, for classic questions the simulator doesn't run (a rate limiter, ticket booking, search suggestions and nearby places): the same 45 minutes and questions, with the design written out and a reference design to hold it against.
In the wild
The ideas in this chapter, and where you'll meet them in real systems and interviews:
| Idea | Where you'll meet it |
|---|---|
| Books | "Designing Data-Intensive Applications" by Martin Kleppmann; "System Design Interview" by Alex Xu |
| Real shorteners | bit.ly, TinyURL, t.co |
| Redirect status codes | RFC 9110 (HTTP Semantics), the section on redirection status codes, which defines 301 and 302 |
| Latency numbers | Jeff Dean's "Numbers Everyone Should Know", from his talks on large-scale systems |
Your practice
Estimate ink.ly: work the chain from the requirements to requests a second and storage, the way you would on a whiteboard. Every step within a factor of two finishes the chapter. You'll build ink.ly for real once you have its boxes, in the URL Shortener case study.