0%
System Design Interview Framework: A Repeatable Plan From Requirements to Wrap Up
The Interview Itself
The Framework Step by Step
Walkthrough: Ticket Booking With a Flash Sale
This lesson and the two after it are worked walkthroughs. Each one takes a common interview problem and runs the whole framework on it, step by step, with the conversation shown as it might happen. The aim is to see how the pieces from earlier lessons fit together in a real session: how scoping leads to numbers, numbers to decisions, decisions to a deep dive and the deep dive to a wrap up. Read the dialogue as an example, not a script. Your own interview will go differently, but the shape should be similar.
The first walkthrough is a ticket booking system with a flash sale. It is a popular prompt because the product is simple to understand but hides one of the most instructive problems in system design: many people competing for a small number of identical resources at the same moment.
The prompt
The interviewer begins: design a ticket booking system, like the sites used to sell concert tickets. Users can browse events, choose seats and buy them. Some events sell out in minutes. The prompt is short and deliberately open. The candidate's first job is to turn it into a problem that can be designed in forty five minutes.
Scoping the functional requirements
Interview Dialogue
In under a minute, the candidate has narrowed the problem to three flows and found out where the interviewer's interest lies: the on sale moment. That single answer shapes the rest of the session, because it tells the candidate that the deep dive will almost certainly be about contention.
Non functional requirements
Interview Dialogue
The candidate stated correctness first, because it is the requirement that decides the core mechanism. Availability under load came second, and the candidate already hinted at the answer: make people wait rather than fall over. The interviewer's comment about bots added a fairness requirement, which the candidate recorded and scoped.
The estimate
Interview Dialogue
This is the estimate doing its job. The candidate did not compute daily active users or annual storage in detail, because those numbers would not change any decision. Instead they computed the numbers that matter for this problem: hold attempts per second during the sale and seat map reads per second. The conclusion, that this is a contention problem, sets up every decision that follows.
What the interviewer notes so far
After about six minutes, the interviewer has seen a candidate who scoped quickly, confirmed the area of interest, stated correctness and availability requirements precisely, added a requirement from a hint and produced an estimate that identified the core difficulty. That is a strong opening at any level. It also leaves plenty of time for the design and a deep dive, which is where most of the evaluation will happen.
What a weaker opening looks like
For contrast, a weaker opening might spend ten minutes listing features, including resale and promoter dashboards, compute total yearly ticket sales in detail and never say that the problem is contention. Nothing in it would be wrong. But the candidate would have used a quarter of the interview without producing a single decision, and the interviewer would still not know whether they understand the hard part.
Writing it on the board
Throughout this opening, the candidate writes the agreed points in a corner of the board: browse, hold, pay; no double selling; stay up under load, waiting is fine; seat map fast; hold five minutes; fairness and bots; fifty thousand seats, two hundred thousand buyers, about eight thousand holds a second peak. That short list will be pointed at again and again, whenever a decision needs justifying.
Why the interviewer asked about the on sale moment
The interviewer's answer, the on sale moment is what I care about, is a strong signal and worth reading carefully. It means the rubric for this problem almost certainly has a line about handling contention and load spikes, and that the deep dive will be judged mostly on that topic. A candidate who hears it should plan the session around it: keep browsing and account features brief, size the sale carefully in the estimate and protect at least ten minutes for the contention discussion. Hints like this one are the most valuable information you get in the first five minutes, and acting on them is a large part of what makes the rest of the interview go smoothly.
Questions the candidate did not need to ask
It is also instructive to notice which questions the candidate skipped. They did not ask about the number of registered users, the number of venues, the mobile platforms supported or the languages the site must serve. Each of these could matter in some version of the problem, but none affects how seats are held during a sale. Every question in the opening should either narrow the scope or produce a number or requirement that decides something. Questions that do neither use time and can make the candidate seem unsure where the problem lies.
Confirming the numbers with the interviewer
After the estimate, the candidate could add a short check: does fifty thousand seats and two hundred thousand buyers in the first minute sound like the right scale? Interviewers often have a scale in mind, and occasionally it is very different, such as a hundred thousand seats or a million buyers. Confirming takes five seconds, and if the interviewer gives a different number, the candidate can rerun the arithmetic quickly. The conclusion, a contention problem rather than a storage one, would hold at any of these scales, which is worth saying too.
In ticketing, the useful numbers are hold attempts per second during the sale and seat map reads per second, not yearly totals. When the estimate ends with a sentence like this is a contention problem, it has done its job: every later decision now has a reason.
With the requirements and numbers agreed, the candidate moves to the API and the data model. In this walkthrough both are short, because the problem is not about complex queries or many entities. But they matter, because the data model is where the core mechanism, the seat hold, is defined.
The API
Interview Dialogue
The API is five endpoints, stated in about thirty seconds. The interesting part is not the format but the semantics: holds are explicit resources with an expiry, and both writes carry idempotency keys. The interviewer's question gave the candidate a chance to explain why, which they did in two sentences tied to the conditions of a sale.
Why holds are a separate resource
Making the hold its own resource, rather than a flag on an order, has several benefits. It has a clear lifecycle: created, then either purchased, released or expired. It can carry an expiry time. It can hold several seats together, so a buyer choosing four seats in a row either gets all four or none. And it gives the purchase step something to refer to, so the purchase can check that the hold is still valid before charging.
The data model
Interview Dialogue
That last answer is the key insight of the data model. By storing the expiry on the seat row, the candidate made the availability check a single condition on a single row, which is what makes the conditional update in the high level design possible. Expired holds are effectively available the moment they expire, without waiting for a background job.
Partitioning the seat data
Interview Dialogue
The candidate chose the partition key from the access pattern, explained the benefit for multi seat holds and named the risk, a hot partition for a big event, without trying to solve it yet. Deferring it explicitly to the deep dive keeps the data model step short and signals that the candidate knows where the difficulty lies.
General admission
Interview Dialogue
The interviewer had mentioned general admission as a special case, and the candidate handled it in one breath, showing that the same pattern, a conditional update, applies with a different data shape. That brief mention covers the requirement without spending time on it.
What is deliberately missing
The candidate did not design tables for promoters, venues in detail, pricing rules or user accounts. Each could be discussed, but none affects the core mechanism. Saying so briefly, I am leaving venue configuration and pricing as simple reference tables, tells the interviewer that the omissions are deliberate.
The state of the board
After about twelve minutes, the board has the requirements and numbers in one corner, five endpoints in another and three tables with their keys. Everything needed for the high level design is visible, and the core mechanism, a conditional update on a seat row with an expiry, has already been introduced. The rest of the interview builds on it.
Reading the API back against the requirements
A quick way to check an API is to read it back against the requirements. No double selling: the hold endpoint creates holds that the store decides atomically, and the purchase endpoint checks the hold. Stay up under load: the endpoints are simple, and the waiting room will gate the hold endpoint. Fast browsing: the event and seat map reads are separate GET endpoints that can be cached. Hold duration: the hold response includes its expiry. Fairness: the waiting room token will be required on holds. Every requirement maps to something in the API or to a component still to come, which tells the candidate that nothing has been forgotten.
Choosing what the seat map returns
The seat map endpoint returns every seat with its status, which for a stadium is fifty thousand entries. At around twenty bytes each, compressed, that is roughly a megabyte, which is acceptable for a page that is loaded once and then refreshed. For refreshes, the endpoint could return only seats whose status has changed since a given version, which cuts the payload dramatically during the sale. Mentioning this in a sentence shows attention to the read load without turning the API step into a performance discussion.
Indexes the store needs
The seats table is accessed by event and seat for holds, and by event for the seat map, both served by the primary key. The holds table needs an index on expiry time for the cleanup worker and on the idempotency key for retries. The orders table needs an index on user for a buyer's order history. Naming these in one sentence confirms that the queries in the API are all efficient, which interviewers sometimes check directly.
Keeping the step short
The whole API and data model step took about six minutes. That is deliberate: the step must be present and correct, but the problem's difficulty lies elsewhere, so the candidate kept it compact and moved on while the interviewer was still engaged. A good sign of the right length is that each part of the step produced something used later.
Anything that did not feed a later decision was left out on purpose, which kept the step brisk and the interviewer's attention on the parts that mattered.
Storing hold expiry on the seat row lets one conditional update decide availability: available, or held with an expiry in the past. Expired holds become available instantly, with no cleanup job on the critical path.
The high level design brings the requirements, the API and the data model together into a picture of the system. In this walkthrough, the candidate draws the normal path first, then adds what the flash sale needs, so that the interviewer can see which parts exist for everyday use and which exist for the sale.
The normal path
Interview Dialogue
This is a compact normal path: five or six components, each with a reason. The candidate answered the database question with the two properties that matter, transactions and conditional updates, and noted that the data volume did not require anything more exotic.
Adding the waiting room
Interview Dialogue
The waiting room is the most important component in the design, and the candidate introduced it with its reason, the contention on one partition, and its benefits for fairness, bots and experience. Note that the candidate did not try to make the database handle unlimited load. Admission control is the classic answer to a demand spike that exceeds a resource's capacity, and recognising it is a sign of experience.
The seat map under load
Interview Dialogue
This exchange shows a trade off stated in full: the choice, the reason, the cost and why the cost is acceptable. The candidate also separated two concerns that are easy to confuse: how fresh the display is, and how correct the sale is.
Walking the main flow
Interview Dialogue
Walking a single request through the design is a quick way to check that every step is connected and to give the interviewer a clear picture. It also surfaces the points where something could go wrong, which sets up the deep dive and the failure discussion.
What the design leaves for later
The candidate has deliberately left three questions open: exactly how contention is handled on the hottest seats, how holds expire and are cleaned up, and what happens when payment times out. Each will be covered in the deep dive or the failure discussion. Leaving them visible, rather than glossing over them, gives the interviewer a natural choice of where to go next.
Checking in
Interview Dialogue
The check in at the end of the high level design confirmed the deep dive and made a plan for the remaining time. The candidate is now about twenty two minutes in, with more than twenty minutes for depth and failure handling.
Where the waiting room state lives
The waiting room needs to track the queue position of every buyer and the rate at which they are admitted. For two hundred thousand buyers, that is small: an ordered list in a fast in memory store, with each buyer's position keyed by a session identifier. Admission is a simple loop that takes the next batch from the head of the list every second. The buyer's client polls the waiting room for its position every few seconds, which at two hundred thousand buyers is tens of thousands of light reads a second, easily served from memory or a cache. If the in memory store fails, the queue can be rebuilt approximately from join times, and the waiting room can pause admission briefly while it recovers.
Normal days versus sale days
Most of the time, the system sells tickets for many small events at a gentle rate, and the waiting room is not needed at all. A sensible design enables it per event, either because the event is expected to be popular or automatically when traffic to an event crosses a threshold. This keeps the normal path simple and avoids making every buyer wait for no reason. Saying so shows that the candidate thinks about the system across its whole life, not only during its hardest minute.
Static content and the content network
Event pages, venue images and the static parts of the seat map, such as its layout, do not change during the sale. They should be served from a content delivery network close to users, leaving the origin to serve only the dynamic seat statuses. This removes a large part of the read load from the system at almost no cost, and it is the kind of easy win that is worth one sentence in the high level design.
Every component on the board now has a stated reason.
When demand for a resource exceeds its capacity by orders of magnitude for a short time, scaling the resource is usually the wrong answer. Admit work at a rate the resource can handle and make everyone else wait fairly. A waiting room protects the store, enforces fairness and gives a better experience than errors.
The deep dive is where the interview is decided. In this walkthrough the interviewer chose contention, which is exactly where the candidate expected the difficulty to be. The candidate now compares the main options for deciding who gets a seat, explains why the chosen one works, handles the hottest seats and covers hold expiry.
Comparing the options
Interview Dialogue
The candidate compared three options on the deciding concerns: behaviour under contention, throughput and failure. This is a compact but complete comparison, and it ends with a clear decision and a reason.
How the race is decided
Interview Dialogue
The answer is mechanism level: it names the condition, the order in which the database applies the writes and the outcome for each buyer. It also includes a small product touch, returning nearby available seats, which improves the experience for the losing buyer.
The hottest seats
Interview Dialogue
This is where the deep dive goes beyond the standard answer. Best available assignment changes the shape of demand, which is often more effective than making the contended path faster. The in memory filter is an optimisation clearly marked as non authoritative, so it cannot cause an oversell.
Hold expiry
Interview Dialogue
The candidate made the important point that correctness does not depend on the cleanup worker, which only keeps the display tidy. The edge case at the end of the hold was handled with a condition on the purchase and a small product fix, a one time extension when payment starts.
What this deep dive showed
In about ten minutes, the candidate compared three approaches with clear reasons, walked through the race at the level of individual writes, reshaped demand for the hottest seats, added a safe optimisation and handled expiry including an edge case. Each step was tied back to the requirements on the board: no double selling, stay up under load, fairness.
A deeper follow up
Interview Dialogue
The candidate compared on the deciding concern, durability, found a partial use for the suggestion and made it conditional on measurement, which is exactly how to handle a challenge in a deep dive.
Measuring whether the design holds
The candidate could also say how they would know the design works before the big sale. Load test the booking path against a copy of a large event at the expected peak rate, watching the seat partition's write latency and conflict rate. Set the waiting room's admission rate from the test results, with a margin. During the real sale, watch hold latency, conflict rate, waiting room depth and payment success rate on a dashboard, with an alert if hold latency rises above a threshold so the admission rate can be lowered. These details are not required at mid level, but they are a strong addition at senior and staff level, because they show how the design would be operated rather than just drawn.
Why not shard one event across partitions
An interviewer might ask whether one huge event could be split across several partitions, by section for example, to spread the write load. It could, and it would raise the throughput ceiling. The cost is that a multi seat hold spanning two sections becomes a cross partition transaction, and the seat map must be assembled from several partitions. With the waiting room capping the rate, the single partition is usually enough, so the candidate would mention section level splitting as the next step if load tests showed the partition was still the bottleneck.
Each of these details is optional, but together they turn a correct design into one that a team could actually run.
If seats only become available again after a background job runs, a slow or failed job blocks sales. Put the expiry in the condition that decides availability, so expired holds are takeable immediately, and let the cleanup job only tidy the display.
With the deep dive done and about ten minutes left, the candidate covers payments and failure handling, then closes with a summary. This final stretch is where many candidates run out of time, which is one reason the earlier steps were kept tight.
Payment failures
Interview Dialogue
The candidate handled the most important payment failure, the ambiguous timeout, with the standard tools: idempotency keys, a pending state and reconciliation. Each piece has a clear purpose, and the explanation took under a minute.
Other failures
Interview Dialogue
The candidate covered each major component in a sentence or two, and for each one said what users experience. Choosing to fail closed for the waiting room, with the reason, is a good example of thinking about failure behaviour rather than just redundancy.
The trade offs
Interview Dialogue
Three headline trade offs, each in one sentence with its cost. These are the decisions that most shaped the design, and they are exactly what the interviewer will want in the notes.
Extensions and evolution
Interview Dialogue
Naming extensions with a sentence each shows breadth and judgment about what comes next, without spending time on any of them.
The close
Interview Dialogue
The close took about thirty seconds and restated the design in terms of the requirements: no double selling, staying up under load and fairness.
Looking back at the session
Looking back at the whole session, the time split was roughly six minutes on requirements and numbers, six on the API and data model, ten on the high level design, twelve on the deep dive and eight on payments, failures and the wrap up. That split put most of the time into the part of the problem where the difficulty lived, which is what the earlier lessons on time planning recommend.
What made it strong
Several things made this walkthrough strong. The estimate identified the problem as contention. The data model placed the expiry where the decision is made. The high level design added admission control rather than trying to scale a hot partition. The deep dive compared real options and went to the level of individual writes. Failures were handled with what the user experiences. And every major decision was stated as a trade off tied to a requirement on the board.
Common mistakes on this problem
The most common mistakes on this problem are worth knowing. Treating it as a generic web app and never discussing contention. Using a distributed lock service for every seat without considering throughput. Making seats available again only through a cleanup job. Reading the seat map from the database on every request during the sale. Retrying payments without idempotency keys. And spending so long on requirements that there is no time for the deep dive. Each of these appears regularly, and each is avoided by the framework.
Questions the interviewer might still ask
Even after a strong wrap up, an interviewer with a few minutes left may ask one more probing question. How would you stop one user buying all the tickets? Limit tickets per account per event, enforced in the hold service, and tie accounts to verified payment methods. What if a promoter wants to release more seats mid sale? Insert them as available rows and refresh the map; the waiting room admission rate may be raised slightly. How do refunds work? A refund marks the order refunded and the seats available again, through the same conditional update path. Answering each in a sentence or two, using the components already on the board, shows that the design is coherent enough to absorb new questions without being redrawn.
Practising this walkthrough
To practise, try running this problem yourself in forty five minutes without looking at the dialogue, then compare. Pay attention to where your time went, whether your estimate identified contention and whether your deep dive compared real options at the level of individual writes.
Comparing with your own attempt
When you compare your attempt with this one, do not worry if your components differ. Many designs can work. What matters is whether each of your decisions had a reason tied to a requirement, whether you found the contention problem early and whether you left enough time to go deep on it. Those habits, more than any particular component, are what the interviewer is evaluating.
Variations to try next
Once this version feels comfortable, try variations: general admission only, a sale across several venues at once, or a requirement that buyers can hold seats for fifteen minutes. Each variation changes one or two decisions while leaving most of the design intact, which is good practice for the follow up questions interviewers like to ask.
One last habit
Finally, notice that the candidate never apologised for the design or hedged the summary. A confident close, stated in terms of the requirements, leaves the interviewer with a clear picture to write up, and it is the last impression they take into the debrief.
That clarity is worth practising as much as the design itself.
A mid level answer reaches conditional holds with expiry and a cache for the seat map, with some guidance. A senior answer adds the waiting room unprompted, compares locking options with reasons and handles payment timeouts with idempotency and reconciliation. A staff answer also reshapes demand with best available assignment, chooses fail closed behaviour for the waiting room and discusses how the design evolves for global events and resale.