System design interview guide
Booking Waitlist System Design
Picture a concert that sold out in ten minutes, and you are one of thousands of people who joined a waiting list in case someone cancels. Days later a single ticket comes back. The venue wants to offer it to whoever has waited the longest, give that person a short time to say yes, and move on to the next person if they do not answer. The system that runs this list is called a booking waitlist. The painful failure is when two people are both told the same ticket is theirs, because the messages went out before either answer came back.

Problem statement
Design a waitlist for a booking product (concert tickets, clinic appointments, hotel rooms) that has sold out. Users join a queue, cancellations release capacity, the system offers the spot to the next eligible user, the offer expires if ignored, and accepting the offer must safely create one booking without skipping people unfairly.
Introduction
The problem: a sold-out concert and a list
Picture a band announcing a show. Every ticket is gone in ten minutes, and thousands of people who missed out are disappointed. The venue does not want to turn them away for good, because tickets do get returned: someone gets sick, a flight is cancelled, a plan changes. So the venue lets people put their name on a waiting list, with the promise that if a ticket comes back, someone from the list will get a chance at it.
Now follow one returned ticket. A person cancels on a Tuesday afternoon. Thousands of people are waiting, and exactly one of them should be told “a ticket is yours if you want it.” They need a little time to see the message, think and pay, so the offer cannot last forever. If they never answer, the ticket has to go to the next person. If they answer yes twice because their phone froze, they must still end up with one ticket and one charge. And if the message reaches them late, nobody should feel cheated.
That list, together with the rules for offering, expiring and accepting, is what we call a waitlist. It looks like a simple queue, which is why interviewers like it. The queue itself is easy to describe, and almost everything interesting happens in the moments when a ticket comes back.
Why teams bother with waitlists
You have probably been on one without thinking about the engineering. Airlines keep standby lists, restaurants keep walk-in lists, clinics keep lists for cancelled appointments, and ticket sites let you “join the queue” when a show is gone. Behind each one is a reason the company cares.
Recovering revenue. Cancelled bookings are lost sales if nobody is waiting to take them. A good waitlist turns an empty seat into a sold seat within minutes.
Fairness and trust. When demand is far above supply, people accept not getting a seat. They do not accept watching someone who joined later get it. A visible, explainable order is what keeps them from feeling cheated.
Fewer wasted resources. An empty seat, an empty appointment or an empty room costs the business money and sometimes costs someone their health or travel plans. Refilling it quickly is worth real effort.
Less pressure on the booking system. If there were no waitlist, thousands of people would refresh the booking page all day hoping a seat appears. A waitlist replaces that flood of refreshes with one orderly line.
What problem are we solving?
When a spot comes back, the system must answer one question:
“Who gets the next chance, and how do we make sure only that one person can take it?”
The inputs are simple. People join and leave the line. The booking system reports that a spot has been freed. People respond to offers, or they do not. The output is one booking per returned spot, given to the right person, with a clear record of why it was them.
Several things make this harder than it sounds. A message can arrive late, after the offer is almost over. People double tap buttons. Servers crash halfway through a step and run it again. Cancellations can arrive in a burst. And some people will try to cheat the line with extra accounts. Through all of that the system must still pick one winner per spot and be able to explain the order afterward.
We will not guess at the design yet. First we agree on what the system must do and how well, then we size it, and only then do we make the design decisions one at a time, so each choice has a reason behind it.
This page is in the system design interview guides hub.
How to approach
In an interview you do not start by drawing boxes. You start by turning a short, vague prompt into a clear contract: how the line is ordered, what an offer is, what the system must do, how well it must do it, and what is out of scope. Only then do you size the problem, make the design decisions one at a time, and draw the result. The list below is the order this page follows.
How to design a booking waitlist in an interview
- Clarify the problem: how the line is ordered, whether one spot goes to one person or to several, how long an offer lasts and when its clock starts, what Accept does, and whether people see their exact position.
- Write the functional requirements (what the system does) and the non-functional requirements (how correct, how fast, how fair).
- Estimate the size: people waiting per show, how many spots can come back at once, how long offers last, and how fast messages can be sent.
- Make the design decisions in order: the ordering rule, where the line is stored, how a freed spot becomes one offer, how people are told, how an offer expires, how Accept becomes one booking, and how the line stays honest.
- Draw the picture those decisions produce, then walk one freed spot through it from cancellation to booking.
- Go deeper where the interviewer pushes: two workers racing, double taps, an accept that lands at the same moment as the expiry, late messages, and abuse.
Clarifying questions (say these in the room)
In a real interview the prompt is only a sentence: “Design a waitlist for sold-out bookings.” Before you design anything, ask questions until the problem is clear. Each answer below changes the design, which is why it is worth asking.
You: “Is the default strict first come, first served, or do some people have priority?”
Interviewer: “Start with earlier-first. You can mention priority as a variant.”
That answer fixes the rule for the line. The order is decided by when someone joined, with a tie-breaker for two people who join at the same instant. It also means support must be able to explain the order in plain words, so the system has to remember why each person was chosen.
You: “When a spot comes back, do we offer that one spot to one person, or tell several people and let the first one to accept win?”
Interviewer: “One spot to one person for the main design.”
So there is exactly one open offer per returned spot. If you told many people about one spot, you would be building a race or a lottery instead of a line, and you would have to say so out loud.
You: “How long does an offer last, and does that clock start when we create the offer or when the message is delivered?”
Interviewer: “A fixed window from the moment the offer is created, but account for message delay.”
That tells you the offer itself, stored in the system and shown in the app, is the real thing, and the text message is only a nudge. The clock is the one stored on the offer, and slow delivery is something you measure and plan for, not a reason to lose the offer.
You: “Does Accept create the booking, or does it only claim the spot before a separate checkout?”
Interviewer: “Accept should create or hold the booking through the booking service.”
Now you know the waitlist is not the system that sells seats. It hands the person a chance, and the booking service, the existing system that really owns seats and payment, makes the final call. Accept therefore has to be safe to repeat.
You: “Roughly how many people wait on a hot show, and how many spots can come back at once?”
Interviewer: “Assume a few hundred thousand waiting on a hot show, and a storm can cancel hundreds of bookings at once.”
Those numbers feed the capacity estimate in the next section. They also tell you early that one show needs its own ordered stream of work, while different shows can run in parallel.
You: “Do people see their exact position in line?”
Interviewer: “Your choice. Explain the tradeoffs for support and for bots.”
Exact position builds trust, but it also gives bots a target and creates support tickets when priority rules move people. The system should store the exact order either way, even if the screen only shows a rough band.
You: “I would like to leave the whole ticketing platform, payment card networks, a full anti-bot product and a customer-support case tool out of scope, so we can focus on the line, the offer, Accept and expiry. Does that match what you want?”
Interviewer: “Yes, focus on the waitlist itself.”
If the interviewer later asks about queue brands, partition keys or an exact lock, you do not need to answer yet. Park those until the design decisions, where each one has a natural place.
Functional requirements
Functional requirements describe what the system does. From the answers above, a booking waitlist must:
- Let a person join the line for a sold-out item, once. The same person pressing Join twice, or their phone retrying the request, must not create two places in line.
- Let a person leave the line. People change their minds, and an empty place that nobody is using should not hold up everyone behind it.
- Turn each returned spot into one offer for the next eligible person. The next person is decided by the ordering rule, and there is never more than one open offer for the same spot.
- Tell the person about the offer, and show it in the app. The message may be a push notification, a text or an email, but the offer must also appear inside the app, because messages can be late or lost.
- Let the person accept or decline. Accept creates one real booking through the booking service. Decline gives the spot to the next person straight away.
- Expire an ignored offer and move on. If nobody answers within the window, the offer closes and the spot is offered to the next person.
- Keep a record of every change. For every move in the line, the system keeps who, when and why, so support can answer “why was I skipped?” later.
Non-functional requirements
Non-functional requirements describe how well the system must do its job. They are the numbers and promises that shape the design.
- Fairness you can explain. The order follows a rule that can be said in one sentence and proven from stored records. Without that, every complaint becomes an argument.
- Correctness. One spot is never booked twice, and one person is never charged twice. This matters more than speed, because a double booking means an apology, a refund and a lost customer.
- Safe to repeat. Taps, requests, background jobs and messages can all be run twice by accident. Repeating any of them must not create a second offer, a second booking or a second charge.
- Timeliness. An offer should reach the person quickly after the spot is freed, and the offer window (about 5 to 30 minutes) must be long enough for a real person to notice and answer, but short enough that a spot is not locked up for hours.
- Durability. A server crash must never make a person silently disappear from the line, and must never leave a spot offered to nobody.
- Scale per show. One hot show can have hundreds of thousands of people waiting, and one cancellation storm can free hundreds of spots at once, while other shows stay unaffected.
- Resistance to cheating. Bots and people with several accounts should not be able to jump the line.
Out of scope (and why you park these)
Write a short out-of-scope list on the board so the interviewer sees you can bound the problem.
Building the whole ticketing or reservation platform. The waitlist depends on a booking system that owns seats, but this interview is about the line, the offer, Accept and expiry. Designing seat maps and pricing would use up the round without showing the part that is special about a waitlist.
Payment provider internals. If Accept includes payment, the waitlist calls the booking or payment service with a repeat-safe request and trusts its answer. Card networks are a different interview unless the interviewer asks.
A complete anti-bot vendor. You should mention rate limits, verified accounts and duplicate-account checks, but the main design is fair promotion and safe Accept.
Manual customer-support tools. Support needs a way to read the record of what happened. A full case-management product can stay out of scope.
That is the requirements stage. If you want to practice it before reading on, try the requirements stage on Practice System Design (about 5–10 minutes), then come back for the sizing and the decisions.
Minute pacing (about 40 minutes)
| Minutes | Focus |
|---|---|
| 0–5 | Clarify the ordering rule, one offer per spot, the offer window, what Accept does and what people see; write the requirements; agree out of scope |
| 5–12 | Capacity, then the design decisions and the high-level boxes with one freed-spot story |
| 12–24 | Join, promote, notify, accept and expire in the detailed design |
| 24–34 | The deep dive: two workers racing, double taps, accept versus expiry, late messages |
| 34–40 | Scaling a hot show, failure handling, abuse, and one production story |
In the room (how you open): “I’d start by agreeing what fair means for this product: how the line is ordered, whether one returned spot goes to one person, how long an offer lasts and when its clock starts, and whether Accept creates the booking. I’ll write the functional and non-functional requirements on the board, size a hot show, and then make the design decisions one at a time, so every box I draw has a reason.”
If you remember one thing: Ask first, say the fairness rule in plain words, write the requirements down, and only then design.
Capacity estimation
Once the requirements are clear, the next step is to find out how big the problem is, because the size decides how much machinery the line really needs. A waitlist is quiet most of the time. Nothing happens to a person on the list until a spot comes back, and then a lot of careful work happens for a few people. So the numbers below are about those moments. All of them are rough estimates to say out loud and then confirm with real traffic data.
| Dimension | Example scale (estimate) | What it means |
|---|---|---|
| Waiters per hot show | 200K or more | Look up “the next person” through an index on show and order; never scan the whole list. |
| Storage for the line | 200K entries × about 200 bytes ≈ 40 MB per show | The line itself is small. One ordinary database holds many shows, so this is a correctness problem, not a storage problem. |
| Cancellation bursts | Hundreds or thousands at once | Promote in controlled batches and respect the message provider’s speed limit. |
| Offer window | 5–30 minutes | The expiry job must be reliable and visible in metrics. |
| Message latency | Seconds to minutes, depending on channel | The in-app offer must be primary, and delivery delay must be measured. |
| Message provider speed | Illustrative cap of about 10 texts per second | 500 offers sent as texts would take about 50 seconds to leave the building; the window must account for that. |
| Accept traffic | Spiky right after messages go out | Accept must be safe to repeat and protected against double taps. |
| History | About 5 changes per person × 200K ≈ 1M rows (about 200 MB) per hot show | Keep compact change records, not only current state, and move old ones to cheaper storage. |
What the numbers imply
- The data is small; the care is in the order of work. A line of 200K people fits easily in one database, so the interesting part is making sure one returned spot is handled once, in order.
- Work per show must be one ordered stream. One concert needs its decisions made one after another, while other concerts run in parallel. That points to splitting work by show, not to one global lock.
- Bursts, not averages, set the load. A storm that frees 500 spots creates 500 offers within seconds. The line must hold up under that, even though the daily average looks tiny.
- The message provider is the slowest part. You can create offers far faster than texts can be sent. That is one more reason the offer lives in the app and the text is only a nudge.
- Keep history, but not hot. Audit records must live for months, so keep them compact and archive old ones.
Checkpoint: What happens to the line if 500 spots come back in the same second, and why is the message provider the slowest part?
If you remember one thing: The line is small; the hard part is handling each returned spot once, in order, per show.
Design decisions
We now know what the system must do, how correct it must be and roughly how big it is. Now we choose. Each decision below answers one question that the requirements raised, and each one rules out an easier idea that would not survive the requirements. Read them in order, because every decision builds on the one before it.
Decision 1: Who is next in line?
The first requirement was fairness you can explain. Before storing anything, the system needs a rule for who is next, because the data, the support story and the abuse controls all depend on it.
The simplest idea is first come, first served: whoever joined earliest goes first. It is easy to say and easy to defend, which is why it is the default. Two details make it real. Two people can join in the same millisecond, so each entry also gets a tie-breaker, a steadily increasing sequence number, and the order is the pair of join time and sequence number. And the rule must be stored with each entry (a score and a policy version), so that the order is a fact in the database and not something recomputed from a guess.
First come, first served has real weaknesses. Bots can join at the very first instant. People who cannot be online the second a show sells out are always behind. And some products have good reasons to let certain people go first. The alternatives are priority bands (for example accessibility needs or loyalty members go first, and first come, first served applies inside each band), a lottery among eligible waiters (for shows where demand is far above supply), and offer waves (tell several people at once when several spots come back). The comparison table in Core design approaches shows when each one fits.
We choose strict first come, first served inside the show as the main design, because it is the easiest to defend, and we treat priority as a versioned rule that changes the score, never as a hidden manual override. That choice shapes everything after it.
Decision 2: Where do we remember the line?
The next question is where the line itself lives. The simplest idea is a fast in-memory queue: when someone joins, push them in, and when a spot comes back, pop the next person out. It is quick and takes ten lines of code.
It fails the durability and fairness requirements. If the machine holding the queue restarts, the line is gone and thousands of people lose their places silently. If a worker pops a person and crashes before telling them, that person has vanished and nobody can say why. And a memory-only queue keeps no record of past moves, so “why was I skipped?” has no answer.
So the line is stored in a durable database, one row per person per show, with their state (waiting, offered, accepted and so on), join time, score and policy version. A database can enforce the rules that matter with uniqueness: one active entry per person per show, so a retried Join cannot add a second place. A fast in-memory structure is still welcome as a copy for quick “how many are ahead of me?” reads, but the database is the truth and the memory copy can always be rebuilt.
Decision 3: How does one returned spot become exactly one offer?
Now we reach the heart of the requirements: one spot, one offer, even when things go wrong. The booking system tells the waitlist “a spot came back” by sending an event, which is a small message saying what happened. The simplest idea is to have a worker read that message, pick the next waiting person, send them a text and move on.
This breaks two requirements. If the worker crashes after picking the person but before the offer is stored, that person is skipped and the spot is never offered. If the same event is delivered twice, which messaging systems do on purpose to avoid losing messages, two people receive offers for one spot. And with many workers running at once, two of them can both pick the same “next person.”
The fix has three parts. First, record each event by its unique id and ignore it if it was already handled, so a repeat does nothing. Second, make the pick-and-offer a single database transaction, a group of changes that either all happen or none do: mark the event handled, choose the next waiting person, create the offer with its expiry, write the change record and write the notification to send. Third, make decisions for one show one at a time, either by giving each show to one worker or by taking a lock on that show for the length of the transaction. Different shows still run in parallel.
If the worker crashes before the transaction commits, nothing changed and the event simply runs again. If it crashes after, the offer exists and the notification is waiting to be sent. There is no in-between state where someone has been picked but not recorded.
Decision 4: How do people find out about the offer?
The person has to hear about the offer for it to matter. The simplest idea is to send the text or push message right after creating the offer, in the same piece of code.
That ties the database to an outside provider that can be slow or down. If the provider call fails after the offer was stored, the person never hears about it. If we send first and the database write then fails, the person is told about an offer that does not exist. Neither order is safe.
The fix is the outbox pattern: in the same transaction that creates the offer, we also write a small “please notify this person” record into an outbox table. A separate notification worker reads that table, sends the push, text or email, retries on failure with growing delays, and marks each record sent. Because the record is written together with the offer, the two can never disagree. The messages are sent at least once, so the person may rarely get two, which is a small annoyance and not a correctness problem.
The messages are also only hints. The real offer is stored in the system and shown in an in-app inbox the moment it is created, with its expiry time. Texts can be late, emails can land in spam, and push notifications can be delayed by the phone’s operating system. If the offer only existed inside a text message, a delay would silently eat the person’s window. So the app always shows the offer from the server, and the expiry time on screen is the one on the offer, not the time the message arrived.
Decision 5: How long does an offer last, and what happens when it ends?
An offer cannot last forever, or one inattentive person would block everyone behind them. The simplest idea is to set a timer in memory when the offer is created and promote the next person when it fires.
That fails the durability requirement again: a restart loses every timer, and offers stay open forever. So the expiry is stored as data, an expires_at time on the offer, and a scheduler (a small job that runs every few seconds, or a delayed queue) looks for offers that are still open but past that time. It closes each one and raises a “spot is free” signal for that show.
The window length is a trade-off. A long window, such as 30 minutes, reduces complaints from people who were slow to notice, but it hides the spot from everyone else. A short window, such as 5 minutes, keeps spots moving, but it means more offers per spot and more messages sent. Size it from real measured delivery times plus a reasonable time for a person to react, and state the number.
One more choice is what happens to a person whose offer ran out or who declined. By default they leave the line, which is the simplest rule to explain. Some products put them back at the end. Either is fine if it is stated and recorded. And the important design point is that an expired offer, a decline and a booking failure all feed the same path as a fresh cancellation: “a spot is available for this show.” There is one code path for “offer this spot,” so there is only one place to get it right.
Decision 6: How does Accept become exactly one booking?
Accept is where money and seats change hands, so it must be the most careful step. The simplest idea is: when the person taps Accept, check that the offer is still open, call the booking service, and mark the offer accepted.
It breaks in three ways. A person on a weak connection taps twice, or the app resends the request after a timeout, and two requests run at once. The expiry job could close the offer while the booking call is still in flight, and promote someone else to the same spot. And the booking call itself could time out, leaving us unsure whether a booking was made.
The fix has three parts. First, claim the offer atomically. In one conditional database update, move the offer from “open” to “accepting” only if it is still open, not expired and owned by this person. Only one request can win that update, and the expiry job’s own update only touches offers that are still open, so the two can never both succeed. Second, make the booking call repeat-safe. The call to the booking service carries a stable idempotency key, a unique id that tells the receiver “this is the same request again”, and the stable key is the offer id, because one offer can produce at most one booking. A retry therefore returns the same booking instead of making a second one. Third, let the booking service decide. The waitlist never sells a seat itself. If booking answers “that seat is gone” (a conflict), the offer closes with that reason and the next person is offered the spot.
Decision 7: How do we keep the line honest and safe from cheating?
The last decision is about trust. A line that people cannot verify turns every skipped person into a complaint, and a line that bots can game turns every real person into a loser.
For trust, every change in the line, such as joined, offered, accepted, expired or skipped, is written as a small audit record with the old state, the new state, the policy version, the score, a reason code and who or what caused it. That record is product data, not debugging output. Logs expire and are hard to search, while audit records can answer “why was I skipped two weeks ago?” in seconds.
For cheating, we combine cheap checks: only signed-in, verified accounts can join, rate limits on joining and accepting by account, device and network address, a uniqueness rule so one person cannot hold two active places, and caps on how many people can wait for one show. Offers carry an unguessable token tied to the person’s account, so holding a link is never enough to accept someone else’s offer.
Putting the decisions together
Taken together, the seven decisions are the design. People are put in a durable line ordered by a stated rule. When the booking system reports a returned spot, one transaction per show picks the next person, creates a time-limited offer, writes the notification to send and records why. The person sees the offer in the app, and messages nudge them. Accept claims the offer with one conditional update and asks the booking service for one booking using a stable key. If the offer is ignored, declined or fails to book, the same path offers the spot to the next person.
In the room (a fuller opening you can actually say): “I’d say the fairness rule first: earlier waiter goes first, with a sequence number to break ties, and priority only as a versioned rule. I’d store the line in a database, not a memory queue, so a crash cannot lose anyone. When a spot comes back, one transaction for that show records the event, picks the next waiting person, creates an expiring offer, and writes a notification into an outbox, so the offer and the message can never disagree. The in-app offer is the real thing; text and email are hints. Accept claims the offer with one conditional update and calls the booking service with a stable idempotency key, and the booking service stays the final authority on inventory. If the offer expires, is declined, or booking says the seat is gone, the same path offers the spot to the next person, and every step is audited.”
The next section draws these decisions as one picture and shows who owns what.
High-level architecture
The decisions above were made one at a time. This section puts them on one page as a picture: which boxes exist, who owns what, and how one returned spot travels through them. The deeper mechanics come later, so keep this at the level of a map.
The high-level design has four parts: a waitlist API (the door the app talks to), a durable waitlist store (the database that remembers the line), promotion workers (background jobs that turn a freed spot into one offer), and notification workers (background jobs that send messages). The booking service sits beside the waitlist and remains the final say on seats and payment.
People join through the waitlist API, which creates a lasting entry in the waiting state (WAITING). When someone cancels or inventory is added, the booking service sends a small message that says a spot came back (CapacityReleased). A promotion worker handles that message for the show, picks the next eligible person, creates an offered record with an end time (expires_at), and writes a “please notify” outbox record in the same all-or-nothing database step. The notification service then sends push, text, or email from that outbox. When the person taps Accept, the waitlist API calls the booking service with a stable repeat-safe key (an idempotency key) and moves the offer to a finished state such as accepted, declined, or expired.
[ User app ] ---> [ Waitlist API ] ---> [ Waitlist DB ]
| ^ |
| | | outbox
| | v
| [ Notification workers ] <--- offer events
|
+-- accept offer --> [ Waitlist API ] ---> [ Booking service ] ---> [ Inventory DB ]
[ Booking cancellation ] ---> event bus ---> [ Promotion worker per resource ]
In the room: Make the boundary explicit. The waitlist chooses the next user and creates an offer. The booking service confirms the actual seat or slot. That prevents the waitlist from becoming a second, weaker inventory system.
Core design approaches
Decision 1 chose strict first come, first served as the main design. This section lays out the alternatives side by side, because an interviewer may ask why you did not pick another one, and you should be able to say when each would be the right choice.
| Policy | How it behaves | Good when | Watch out |
|---|---|---|---|
| Strict first come, first served (FIFO) | Earliest valid join gets the next offer | Public fairness promise | People may wait long; bots optimize join time. |
| Priority bands | VIP, accessibility, loyalty, or policy groups go first, earlier-waiter-first inside each band | Business rules matter | Must be honest and auditable or people feel skipped. |
| Lottery from eligible waiters | Random draw for very scarce drops | Demand is far above supply | Harder to explain individual position. |
| Offer waves | Notify several people for several seats | Many cancellations arrive together | Needs careful matching so waves do not oversell. |
For the main interview, strict first come, first served per show is easiest to defend. Store an ordering key such as join time plus a sequence id so two people who join in the same millisecond still have a stable order. If priority is required, make it a versioned rule that changes the score, not a hidden manual override.
The second choice is how the work for one show is kept in order (sometimes called serializing the promotions). A single worker per hot show is simple and fair but can be slow if one show has huge release bursts. Splitting the event stream by show id gives you the same one-at-a-time ordering for that show while different shows run in parallel. Database row locks can also work, but be careful with a lock style that lets a worker skip a row another worker has locked (FOR UPDATE SKIP LOCKED): it can hand the offer to the second person in line while the first is momentarily locked. That is fine for a job queue and wrong for a fair line, so for strict order use one consumer per show, or a lock on the show for the length of the transaction, and say how you avoid two workers creating offers for the same unit.
Data model
The decisions told us what must be remembered, so the next question is what exactly gets stored. The data model needs current state for the product and transition history for trust.
| Record | Important fields | Why it exists |
|---|---|---|
waitlist_entry | entry_id, resource_id, user_id, state, joined_at, score, policy_version | The user's place in the queue. |
offer | offer_id, entry_id, resource_id, quantity, expires_at, state, token_hash | The temporary right to accept. |
capacity_event | event_id, resource_id, quantity, reason, processed_at | Repeat-safe input from booking or admin (same event id does nothing twice). |
booking_attempt | offer_id, idempotency_key, booking_id, result | Ties Accept retries to one booking result. |
transition_audit | from_state, to_state, reason, actor, timestamp | Explains "why was I skipped?" later. |
outbox_event | event type, offer id, channel payload, status | Reliable handoff to notification workers. |
abuse_signal | user, device, IP, reason, action | Detects duplicate joins and bot activity. |
Use uniqueness rules to protect the obvious mistakes: one active waitlist entry per user per show, one active offer per released unit, and one booking attempt per offer. The exact constraint depends on the product, but the intent should be visible in the schema. Two indexes carry the load: one on (resource_id, state, score) to find the next waiting person quickly, and one on (user_id, resource_id) to stop duplicate joins.
An entry moves through WAITING, OFFERED, ACCEPTED, DECLINED, EXPIRED and LEFT. An offer moves through OFFERED, ACCEPTING, ACCEPTED, DECLINED, EXPIRED and CLOSED. The extra ACCEPTING state is what lets Accept claim the offer before the booking call, as Decision 6 explained.
Detailed design
We now know what is stored, so we can put the pieces in motion. This section follows one returned spot, from the cancellation to either a booking or the next person’s offer, and then shows the same thing from the caller’s side in the API. Read it once as a story. The exact queries and the follow-up questions come in the deep dive right after it.
A waitlist journey is easier to explain when every user-visible action moves the entry through one of the states above and writes an audit record. That audit record is not optional polish. It is how support answers the painful question, “Why did someone after me get a spot?”
Joining. When a person joins, the API checks that the show is eligible for a waitlist and that the person is allowed to join. It then inserts a waitlist_entry if one does not already exist for that person and show. The ordering score is created at insert time. For first come, first served, it is the join time plus an ever-increasing sequence id, so two people who join in the same millisecond still have a stable order. The API can return an exact position, a rough band, or simply “you are on the list,” depending on the product choice. The backend still stores the exact order and the policy version.
A spot comes back. When capacity returns, the booking service emits a CapacityReleased event with a unique event id, show id, quantity and reason. The promotion worker handles that event once. If the same event arrives twice, the worker sees it was already processed and creates no duplicate offers. For each returned unit, the worker opens a transaction, selects the next WAITING entry for the show by score, moves it to OFFERED, creates an offer row with expires_at, writes an outbox notification record, writes an audit change and commits. Notification happens after the commit, so a slow SMS provider can never leave the database half-offered.
The person finds out. The person may learn about the offer from push, SMS, email or the app. The in-app offer is the source of truth, because outside channels are delayed and sometimes lost. The offer token should be signed or random enough that nobody can guess someone else’s offer, but the server still checks the database state on Accept. The screen shows the expiry time from the offer record, not from when the message arrived.
Accepting. When the person taps Accept, the API requires an idempotency key from the app. It claims the offer in one conditional update, checking that it is still open, not expired and owned by that person. Then it calls the booking service to create or hold the reservation, passing the offer id as the stable key so a retry returns the same booking result. If booking succeeds, the waitlist marks the offer and entry ACCEPTED. If booking returns a real conflict because inventory disappeared, the waitlist closes the offer with a reason and offers the spot to the next person. If booking times out, the system retries or reconciles before telling the person to try a brand-new accept.
Expiring. Expiry is another input to the same path. A scheduler or delayed queue finds offers where expires_at has passed and the state is still OFFERED. It moves the offer to EXPIRED, writes an audit change, and emits a new capacity-available signal for the same show. The next promotion then runs through the same path as a cancellation, so there is one code path for “this capacity can be offered.”
Declining and leaving. If a person declines an active offer, the offer closes and the spot moves to the next person. If a person leaves while waiting, the entry moves to LEFT. If someone tries to leave while holding an offer, choose a policy: treat it as a decline, or ask for an explicit decline first. Either is fine if the transition is clear and recorded.
- Join: insert one entry per person and show, with a stable score.
- Spot returns: record the event once, then per unit pick the next waiter and create an offer plus an outbox record in one transaction.
- Notify: the outbox worker sends push, text or email; the app shows the offer anyway.
- Accept: claim the offer with one conditional update, then call booking with the offer id as the key.
- Ignore, decline or conflict: close the offer and run the same “offer this spot” path for the next person.
cancel booking -> CapacityReleased(resource)
-> promotion worker -> OFFERED + outbox
-> user sees in-app offer / receives notification
-> POST accept with Idempotency-Key
-> booking service creates reservation
-> waitlist marks ACCEPTED
API design: what the app calls and what comes back
A waitlist is a product feature on top of an existing booking product, so the API design is mostly about three things: what the app calls, what it receives, and the one internal call that starts promotion.
What the app calls.
| Endpoint | Role |
|---|---|
POST /v1/resources/{resource_id}/waitlist:join | Join the queue for a sold-out show. |
DELETE /v1/waitlist/{entry_id} | Leave the waitlist, or decline if policy allows. |
GET /v1/waitlist/{entry_id} | Read current state, visible position band, and any active offer. |
POST /v1/offers/{offer_id}:accept | Accept an active offer with an idempotency key. |
POST /v1/offers/{offer_id}:decline | Decline and release the chance to the next person. |
POST /v1/offers/{offer_id}:accept must include an Idempotency-Key header. The body may include a payment method or checkout details if Accept completes the booking. The server validates ownership and expiry, then claims the offer before calling booking. A repeat of the same request returns the stored result rather than starting again.
GET /v1/waitlist/{entry_id} returns the state, the position band (or an exact number if the product shows one), and the active offer with its expires_at taken from the server. The app uses that time for its countdown, so the countdown never depends on when a message arrived.
The internal call. POST /v1/internal/capacity-released is the call from the booking system or an admin tool that says “a spot is free.” It carries a unique event_id, the show, the quantity and a reason. It is protected so only internal systems can call it, and sending it twice with the same event_id has no extra effect.
Status codes that matter. A 409 means the offer is no longer active (for example it was already accepted or closed). A 410 means the offer expired. A 403 means the person does not own the offer. A 429 means joins or accepts from that account, device or network look abusive. A 503 means booking is temporarily unavailable and the system cannot safely finish Accept, so the person can safely retry with the same key.
Deep dive: the questions an interviewer asks next
You have drawn the design and walked one returned spot through it. This is the point where a good interviewer starts digging, and the questions usually come in a fairly predictable order, because each answer raises the next one. Read this section as that conversation. Each question is followed by an answer you can give, plus a hint of where the interviewer is likely to go next. When you see the next question coming, you can say the answer before they ask.
“One cancelled seat, two workers wake up. How do you make sure only one person is offered it?”
Start with what goes wrong in a weak design. The worker takes the next person from an in-memory queue, sends a message and assumes the job is done. If the worker crashes after taking the person but before writing the offer, that person disappears from the line. If two workers handle the same cancellation, two people receive offers for one seat. And if the notification arrives late, people race at Accept time with stale assumptions.
The safer design makes offer creation a database transition. The worker handles CapacityReleased(event_id) once, locks the next WAITING row for the show, creates an OFFERED row and writes the notification outbox before committing. If the worker crashes after the commit, the outbox relay still sends the message. If it crashes before the commit, no offer exists and the event can be retried.
Bad design
cancel event -> worker pops user from volatile queue
-> sends SMS
-> crashes before durable offer
Result: user may be skipped, and support cannot explain why
Great design
BEGIN
record capacity_event if new (insert by event_id, stop if it already exists)
take the show lock, then select next WAITING entry for the show in order
create OFFERED with expires_at
write transition_audit and outbox event
COMMIT
notification worker sends from outbox

Figure: One cancelled seat creates one expiring offer. The message is sent afterwards from the outbox, and Accept goes through the booking service with a repeat-safe key.
To see the race closed, imagine the same event delivered to two workers at once. Both try to record event_id in the same transaction. The database lets one of them insert it and rejects the other, so the second worker stops without creating anything. Neither worker can see the other’s half-finished work, because there is no half-finished work to see.
Where it goes next: the interviewer will probably ask why you did not simply use a fast queue for the line.
“Why not keep the line in a Redis sorted set? It is much faster.”
Because speed is not what the requirements are asking for here. A sorted set (a Redis structure that keeps entries ordered by a score) is a fine way to find the next person quickly, and a line of 200K people is tiny. The problem is what it does not give you. Redis keeps data in memory and copies it to its replicas a moment later, so a crash or failover can lose the last few joins or the last few removals. It cannot write the offer, the audit record and the outbox record together in one all-or-nothing step. And it gives no history, so “why was I skipped?” has no answer.
So the database is the truth, and a Redis sorted set is welcome only as a rebuildable copy for quick “how many are ahead of me?” reads. If the copy and the database ever disagree, the database wins and the copy is rebuilt. Name the policy first and the storage second: storage supports the fairness rule but does not define it.
Where it goes next: “Fine. The offer exists. What happens when the person taps Accept twice?”
“The person taps Accept twice, or the app retries after a timeout. Do they book twice?”
No, because every layer treats a repeat as the same request. The app sends an Idempotency-Key with Accept, and the server stores it with the offer. When the second request arrives, the server finds that this offer is already being accepted with the same key and returns the stored result instead of starting again.
The more important protection sits one step further down. The call to the booking service carries a stable key, and the stable choice is the offer id, because one offer can produce at most one booking. A key that changes on every tap, such as the offer id plus a new attempt number, would make each retry look like a brand-new request and defeat the whole idea, so avoid that. With the offer id as the key, one request may finish first, and the second returns the same booking id or the same final error.
Where it goes next: “What if the Accept lands at the exact moment the offer expires?”
“What if Accept and the expiry job fire at the same moment?”
This is the sharpest race in the design, and the fix is to make both sides use the same conditional update. Accept runs something like this:
UPDATE offer
SET state = 'ACCEPTING', accept_key = :key
WHERE offer_id = :offer_id
AND user_id = :user_id
AND state = 'OFFERED'
AND expires_at > now();
-- 1 row changed -> this request owns the offer; go on to call booking
-- 0 rows changed -> read the offer: same key already accepting/accepted → return stored result;
-- expired → 410; anything else → 409
The expiry job runs UPDATE offer SET state = 'EXPIRED' WHERE state = 'OFFERED' AND expires_at <= now(). Both statements need the offer to still be OFFERED, and the database lets only one of them change that row. If Accept wins, the offer is ACCEPTING and the expiry job skips it. If expiry wins, Accept changes zero rows and the person is told it expired. Nobody can be told “you have it” and “it expired” for the same offer.
The one gap left is an offer stuck in ACCEPTING because the booking call never finished. A small reconciliation job asks the booking service about the offer id and either completes the accept or releases the offer.
Where it goes next: “And if booking times out, or the seat really is gone?”
“Booking times out, or says the seat no longer exists. What now?”
Treat the two cases differently. A timeout means we do not know whether a booking was made, so the system must not hand the spot to someone else yet. It retries the booking call with the same offer id as the key, or asks booking for the result of that key. Because the key is stable, asking again can never create a second booking. Only when booking gives a clear answer does the waitlist move on.
A conflict (booking says the seat is gone) is a clear answer. The offer closes with that reason, the person is told plainly, and the spot, if there is one, goes to the next person through the same “offer this spot” path. If there is no spot, nothing is offered, and the audit record says why.
Where it goes next: the interviewer may move from correctness to the human side: late messages.
“The text arrives with one minute left on the offer. Is that fair?”
It is only fair if the system was designed for it. The offer window starts when the offer is created, so a delayed message eats into the person’s time. Three things keep that honest. The app shows the offer the moment it exists, with the server’s expiry time, so anyone who opens the app sees it immediately. The window is sized from measured delivery times, such as the 99th-percentile delay of each channel plus a reasonable time to react. And delivery time is measured from offer creation to delivered, per channel, so when one provider slows down, you see it before users complain.
If the product wants the clock to start when the message is delivered instead, that is possible, but it needs delivery receipts from each provider and a more complicated fairness rule, because a provider that is slow or lying could stretch one person’s window. Say that trade-off plainly.
Where it goes next: “If someone says they were skipped, how do you prove what happened?”
“A user says they were skipped two weeks ago. Logs are gone. What do you show them?”
You show the audit records. For every promotion, the system stored the previous and next state, the score, the policy version, a reason code and who or what caused it. So support can replay the path: who was ahead, why that person was chosen, and whether anyone was skipped for a stated reason (for example a duplicate account removed, or a priority band applied). If priority is added later, the order is never silently rewritten. The policy version and reason code explain it.
Say it in the interview: “One transaction per show records the event once, picks the next person, creates an expiring offer and an outbox record, and writes why. Accept claims the offer with a conditional update and calls booking with the offer id as the key. Expiry uses the same conditional update, so the two cannot both win. Booking stays the final authority.”
If you remember one thing: The deep dive is a conversation. A queue pop that is not stored is the red flag, one transaction is the fix, and each answer is something you could have said before they asked.
Key challenges
The deep dive showed that each step is simple once it is durable and conditional. What makes the real system hard is everything around those steps, and six hard parts show up again and again. Name them early in the interview, because each one is a place the interviewer is likely to push.
| Challenge | What users feel | Strong answer |
|---|---|---|
| Fair order | "Someone after me got the spot" | Name the ordering rule out loud and keep a change record for every promotion. |
| Duplicate offers | Two people think they can claim one seat | Handle one show’s promotions one at a time and create lasting offer rows, not a memory-only pop. |
| Offer expiry | Person clicks a stale link | The server checks the offer’s end time; expired offers send the spot to the next person. |
| Notification lag | Text arrives after the clock has almost run out | The in-app offer is the real thing; measure delivery delay by channel. |
| Accept safe to repeat | Double tap creates a second booking or charge | Use one stable repeat-safe key per offer and one booking attempt for that offer. |
| Queue gaming | Bots or duplicate accounts crowd real people | Verified accounts, join rate limits, duplicate detection, and caps on how many can wait. |
Scaling the system
Those hard parts get worse as demand grows, so the next question is what happens when the lines get longer and the cancellations arrive faster. You do not have to wait for the interviewer to ask. Right after you finish the design, say the scaling story yourself, then be ready for the follow-ups.
What you can say upfront: “Each show is its own ordered stream, so I split the work by show id. One show’s decisions run one at a time, which keeps the order fair, and different shows run in parallel on different workers. The line for one hot show is small enough for one database, so the pressure is on the index that finds the next waiting person and on the message provider’s speed limit. Old finished entries move to cheaper storage while the audit stays. For a burst of cancellations I create the offers right away but send the messages in controlled waves, and the app shows every offer immediately, so a slow provider never hides an offer.”
That one paragraph answers most of what follows. Here are the follow-ups, in the order they usually come.
Interviewer: “How do you scale this to thousands of shows?”
You: “By splitting on show id. In a stream system such as Kafka, I use the show id as the partition key, so all events for one show stay in order on one partition while other shows use other partitions. In a database-driven version, I take a lock for the show for the length of one short transaction. Because the order only matters inside one show, there is no global lock and nothing is shared between shows.”
Interviewer: “One show has 200,000 people waiting. Does finding the next person get slow?”
You: “Not with the right index. I keep an index on show, state and score, so ‘the next waiting person’ is a lookup of one row from the front of the index, not a scan of the whole list. A second index on user and show stops duplicate joins. As entries finish, I archive them out of the active table, so a hot show does not carry every old row. The audit stays, but moves to cheaper storage.”
Interviewer: “Five hundred bookings are cancelled at once. What happens?”
You: “Creating 500 offers is quick and correct, because each one is one short transaction for the same show and they run in order. The slow part is the message provider, which only sends so many texts per second. So I send in waves or give each channel a budget, and rely on the in-app offer so people see it right away. The cost is that the last people in a wave get their text later, which is why the window must be sized for that delay, and why I would watch the time from offer to delivered.”
Interviewer: “Can you offer one spot to several people to fill it faster?”
You: “I can, but that changes the product. If I tell three people about one spot, it becomes a race, and the fairness promise becomes ‘first to tap’ and not ‘first in line.’ If I want speed without losing fairness, I can run waves with a stated rule, where the booking service has a lock that only one person can win. I would say the choice out loud and let the product decide.”
If you remember one thing: Split by show, keep decisions inside a show one at a time, and let the in-app offer carry the load that the message provider cannot.
Failure handling
Scaling answers “what if there is more demand.” This section answers “what if something breaks.” Again, say it first. Failures here come from crashed workers, slow providers, retried requests and the booking system, and what impresses an interviewer is that the answer was decided before the failure happened.
What you can say upfront: “Every failure has a decision made in advance. If a promotion worker crashes before it commits, nothing changed and the event runs again. If it crashes after, the offer exists and the outbox sends the message. If the message provider fails, I retry with growing delays and the in-app offer is already visible. If Accept times out, the retry carries the same key and returns the same booking. If booking says the seat is gone, I close the offer with a reason and offer the spot to the next person. If the expiry job falls behind, I alert on offers that are past their time but still open, so spots are not stuck.”
The follow-ups are about the details of those decisions.
Interviewer: “A promotion worker crashes in the middle. What does the user see?”
You: “It depends on when. Before the transaction commits, nothing changed, so the user sees nothing and the event is retried. Because the event is recorded inside the same transaction, the retry sees it was not handled and starts again. After it commits, the offer is already stored and the outbox record is waiting, so a separate worker sends the message. There is never a moment when someone is picked but not recorded.”
Interviewer: “The SMS provider is down. Do people lose their offers?”
You: “No. The offer lives in our database and in the app’s inbox, so the person can still see it. The notification worker retries with growing delays and, if one channel stays down, can try another. I alert on delivery delay by channel. The cost is that some people notice later, which is why the window is sized from real delivery times.”
Interviewer: “Booking is down when the person taps Accept.”
You: “The Accept returns a 503 and the app can retry with the same idempotency key. Because the offer is claimed as
ACCEPTING, the expiry job will not promote someone else to the spot while we are unsure. A reconciliation job checks stuckACCEPTINGoffers against booking using the offer id as the key, then completes them or releases them. I would rather the person see ‘processing’ for a minute than risk two people holding the same seat.”
Interviewer: “The expiry job is delayed for ten minutes. What breaks?”
You: “Spots sit in expired offers, nobody gets promoted, and inventory is free but unused, which is lost sales and lost trust. Accept already checks
expires_atitself, so nobody can accept a stale offer, and the only damage is delay. I alert on offers past their time but still open, and on promotion lag. I can also run the expiry check from a delayed queue as well as the scheduler.”
Interviewer: “A bad message keeps failing and blocks the show.”
You: “That is a poison message: one bad record, such as an invalid phone number or a broken template, that is retried forever. It must not block the show’s other work. After a few tries it moves to a dead-letter path with an alert, while the offer stays visible in the app. The rest of the line keeps moving.”
| Failure | User experience | What to build |
|---|---|---|
| Promotion worker crashes before commit | No visible offer yet | Retry event; no durable state changed. |
| Worker crashes after commit | Offer exists but SMS may not send | Outbox relay sends later; in-app offer visible. |
| Notification provider fails | User may not get SMS or email | Retry with backoff, use in-app inbox as primary, alert on delivery lag. |
| Accept call times out | User sees processing | Idempotent retry returns same booking result after reconciliation. |
| Booking service returns 409 | Offer could not become booking | Close offer with reason and promote next user. |
| Expiry job delayed | Capacity sits in stale offers | Alert on expired active offers and promotion lag. |
If you remember one thing: Every crash point has a stored state behind it, so a retry continues the work and never repeats it.
Observability (what you measure)
Once the system is live, you need a way to tell whether it is healthy, and that takes more than a count of errors. The dangerous failures here are quiet ones: spots that are free but not offered, and people who were treated unfairly without any error being logged.
| Signal | Why it matters |
|---|---|
| Promotion lag from capacity release to offer created | Shows whether returned inventory reaches users quickly. |
| Offer creation to notification delivered by channel | Shows whether the offer window is fair for real users. |
| Active offers past expiry | Finds broken expiry workers. |
| Accept success, conflict, and timeout rates | Shows whether booking integration is healthy. |
| Duplicate join attempts and suspicious devices | Detects queue gaming. |
| Queue position complaints by resource | Finds fairness or communication problems. |
| Audit write failures | A waitlist without audit cannot defend itself. |
A good dashboard answers three questions: who should have been next, when did they get the offer, and what happened when they accepted or expired?
Alert ideas: promotion lag above a few seconds; any offer open past its expires_at; offers stuck in ACCEPTING; delivery time for one channel rising sharply; and any audit write that fails.
Security and abuse
Observability shows when something is wrong; this section covers the people who will try to make it go wrong on purpose. Require signed-in users for joining and accepting. Use rate limits by user, device, network address and payment instrument on hot shows. Prevent duplicate entries for the same user and show, and consider stronger identity checks for high-value events where bots create many accounts. Signed offer tokens should be unguessable and tied to the user’s identity, so holding a link alone can never accept someone else’s offer.
Protect the fairness story from insider abuse too. Admin moves, priority overrides and manual promotions need reason codes and audit records. If the product supports priority, publish or at least clearly document the rule. Hidden manual reordering creates the same trust damage as a technical bug.
Cost awareness
Every choice so far also has a price, and interviewers like to hear that you noticed. Every notification costs money, especially texts. Offering one spot to one person at a time is fair but may lower the chance of a sale if many people ignore messages. Offering in waves improves speed but changes the fairness promise. Choose the policy with product and cost in mind.
Long offer windows reduce complaints about late notifications but hide spots from everyone else. Short windows increase churn and message spend because the same spot may be offered many times. Exact queue positions increase support cost when they move. Audit storage costs money, but it is cheaper than having no proof when users claim they were skipped.
Green Dashboard. Angry Users. The Production Mindset System Design Interviews Expect.
Everything so far describes how the waitlist should work on a good day. This section is about what happens on a bad day, told as short stories from the people who carry the pager (the on-call engineers). Diagrams show boxes and arrows. On-call teaches something else: a waitlist can look healthy while people feel cheated, and it can look busy while spots sit empty.
Scene 1: “I was skipped”
The moment: Two friends joined the waitlist for the same sold-out show. One joined at 10:01 and the other at 10:05. Days later the later friend gets the offer first. The earlier friend opens a support ticket with screenshots and asks why they were skipped, and the agent has nothing to show.
The trap: The system may be technically right, because of priority bands or a duplicate account that was removed, but the team stored only the current line with no change record. A current waiting row does not explain what happened yesterday. If support cannot explain it, people read it as unfair.
What to build: Change records with the policy version, score, reason code and actor for every promotion, so support can reconstruct the path without asking engineers to search raw logs.
Scene 2: Offer expires before the notification arrives
The moment: Someone has waited for weeks on a sold-out show and finally gets an offer. Their phone’s operating system delays the push notification, the text provider is slow, and the email lands in spam. They finally open the link with one minute left, the booking fails, and they are furious.
The trap: The window started when the offer was created, as designed, but nobody measured how long messages really take. The backend followed the rule and the product still looks unfair.
What to build: An in-app inbox that shows active offers the moment they exist, delivery-time metrics for each channel, and an offer length sized from the slowest common delivery time (for example the 99th percentile) plus human reaction time. If the product wants the clock to start at delivery, that is possible, but it needs provider delivery receipts and a more complex fairness rule.
Scene 3: Promotion backlog grows while inventory is free
The moment: Overnight, a cancellation storm frees hundreds of seats for a hot show. In the morning the booking system shows free seats, but people on the waitlist have received no offers for an hour and keep refreshing the app.
The trap: CPU and error rates look normal. The real bottleneck is a hot lock on one show or the message provider’s speed cap, so offers are queued behind slow work. Free seats that are not offered are lost sales and lost trust.
What to build: Alerts on promotion lag, queue depth per show, controls to promote in waves, and message budgets that respect the provider’s limits.
Scene 4: Double accept during a flaky mobile session
The moment: A person on a train has an open offer and taps Accept. The app spins and times out on a weak connection, so they tap again. Both requests reach the server a few seconds apart.
The trap: Without a repeat-safe key, two booking attempts or two payment attempts may start, and the person is charged twice for one seat. With a key that changes on every tap, the same thing happens even though a key exists.
What to build: One stable key per offer so the second call returns the first call’s booking, and a screen that settles on the single result.
In the interview: Use this scene to show that waitlist fairness and booking correctness meet at Accept. The waitlist can offer the chance, but booking must still confirm one real reservation. Pick one scene and tell it like a short story: what people felt, which number lied, and what you would build next. You do not need all four.
Bottlenecks and tradeoffs
Those stories all trace back to a small number of choices where you cannot have both things you want. Interviewers listen for whether you can name the tension, say what breaks, and pick a side on purpose.
Strict fairness vs fast conversion
Offering one spot to one person is fair and easy to explain, because support can point at a single winner. It can be slow if many people ignore offers, and seats sit unused while the clock runs. Waves improve the chance of a sale by telling several people at once, but they turn the design into a competition among notified users. Say which product you are building, and do not pretend a race is still first come, first served.
Exact position vs abuse
Showing “you are number 412” helps trust, because people can see the line move. It also gives bots a target and creates support tickets when priority rules move someone. Showing a rough band such as “within the next few hundred” reduces gaming, but can feel less transparent. Either way, the backend should keep the exact order and a change record, so support can still explain what happened.
Notification speed vs provider limits
You can create offers far faster than text providers can send. If the clock starts when the offer is created, provider lag eats into the person’s window and the last people in a wave feel cheated. Keep the in-app offer as the real thing, give each channel a send budget, and size the window from measured delivery times so the promise stays honest.
Waitlist ownership vs booking truth
If the waitlist tries to own seats itself, it can drift from the booking system and sell a seat that booking no longer has. If booking owns everything and the waitlist only sends messages, you lose the fairness record and cannot explain who was next. The useful split is that the waitlist owns order and offers, and booking owns the final reservation.
Interview tips
You now have a full design and the tradeoffs behind it, so the last thing to practice is defending it when the interviewer pushes back. These five are the pushes that come up most after you finish the design:
Fairness is a policy before it is a data structure
In the room
You might say: “I will keep the waiting people in a Redis sorted set, so the next person is always at the front.”
Interview Push: “Sorted by what, and how do users know the order is fair?”
Land here: Start by saying the fairness rule in plain words, then pick storage that supports it. For strict first come, first served, score by join time plus a deterministic tie-breaker. For priority, store the priority rule version and use first come, first served inside each band. The storage choice supports the policy; it does not define fairness by itself.
One released seat should create one durable offer
In the room
You might say: “When a ticket is cancelled, we take the next user off the queue and send them an SMS.”
Interview Push: “What if the worker crashes after taking the user off the queue but before the SMS or database write?”
Land here: Do not treat a memory-only pop as proof that someone was offered a spot. Create an offer row and the notification outbox record in the same all-or-nothing database step. If the worker crashes after the commit, the offer still exists and the outbox can retry. If it crashes before the commit, the event can retry and choose the same next person.
Accept must be safe to repeat
In the room
You might say: “The accept endpoint calls booking and creates the reservation.”
Interview Push: “The user double taps Accept during a timeout. Do they book twice?”
Land here: Make Accept safe to repeat, meaning a second tap returns the same result instead of a second booking. Require an
Idempotency-Keyon Accept and bind it to the offer. Claim the offer with one conditional update, then send the booking service a stable key, which is the offer id, so a retry returns the same booking id or the same final failure. A key that changes on every tap would not protect anyone. This protects both seats and payment.
Notifications are hints, not the source of truth
In the room
You might say: “We notify the user, and then their offer window starts.”
Interview Push: “How do you know the SMS was delivered, and what if the push is delayed?”
Land here: Treat the offer shown in the app as the real clock, not the text message. Email, text and push help the person notice it, but they may be delayed. Size the offer window from real delivery times, and always show the server’s end time on screen.
Audit is part of the product
In the room
You might say: “If users complain, we can check the logs.”
Interview Push: “A user says they were skipped two weeks ago. Logs expired. What now?”
Land here: Keep a small change history as product data, not only as temporary logs. Store previous state, next state, policy version, score, reason, actor and time. Logs are for debugging. Audit is how support explains fairness.
Red flags to avoid without correcting yourself: “pop the next user from a memory queue,” “send the SMS first and write the offer after,” “a new key for each Accept tap,” “the text message starts the clock.”
What should stick
After working through the requirements, the decisions and the depth sections, you should be able to explain:
- Policy first. First come, first served, priority, lottery or waves must be named before storage.
- One offer per unit. A released seat creates a lasting offer with an end time and a change record, in one transaction per show.
- Notifications come after the offer. The in-app offer is primary; text and email may lag, and the outbox keeps them in step with the offer.
- Accept is safe to repeat. Double taps and retries return the same booking result, and the offer is claimed with one conditional update.
- Booking owns inventory. The waitlist gives a person the chance; booking confirms the seat.
Tell it in the room: “Cancellation emits capacity released. One transaction per show records the event, picks the next waiting person, creates one expiring offer and writes an outbox notification. The user accepts with an idempotency key, the offer is claimed with a conditional update, and booking confirms the real seat using the offer id as its key. Expiry, decline or conflict offers the spot to the next person with an audit record.”
Key Takeaways
- Say the fairness rule in plain words before choosing any storage: earlier waiter first, a sequence number for ties, and priority only as a versioned rule.
- Store the line durably, with one active entry per person per show, instead of in a memory queue that a crash can empty.
- Turn each returned spot into exactly one offer with one transaction per show: record the event once, pick the next person, create the offer and write the outbox record together.
- Treat texts and emails as hints; the in-app offer and its server-side expiry time are the real thing.
- Make Accept safe to repeat by claiming the offer with a conditional update and using the offer id as the booking key, so Accept and expiry can never both win.
- Keep the booking service as the final authority on inventory, and feed expiry, decline and conflict back into the same “offer this spot” path.
- Keep compact audit records so support can explain every promotion, and watch promotion lag, offers past expiry and delivery time by channel.
Related Topics
- Airbnb Reservation System Design - Holds, confirmation, and date-range inventory.
- Vaccine Booking System Design - Last-slot contention and fair admission.
- Notification System Design - Channel delay, retries, and outbox delivery.
- Ticketmaster System Design - High-demand ticketing and queue pressure.
- Rate Limiter System Design - Bot and abuse controls around hot endpoints.
Quick revision notes
The problem in your own words. A booking waitlist decides who gets a freed spot at a sold-out show and makes sure only that one person can take it. The hard part is handling one returned spot exactly once, in order, even when workers crash, messages arrive late and people tap twice.
The design in one breath. People join a durable line ordered by a stated rule. When the booking system reports a returned spot, one transaction per show records the event, picks the next person, creates an expiring offer and writes an outbox record. The app shows the offer right away and messages nudge the person. Accept claims the offer with one conditional update and asks booking for one booking using the offer id as the key. Ignored, declined or failed offers go to the next person through the same path.
The choices you must be able to defend. First come, first served as the default, with priority as a versioned rule. A database for the line, not a memory queue. An outbox for notifications. An offer window sized from real delivery times. Booking as the final inventory authority.
The numbers worth remembering. About 200K people on a hot show is only about 40 MB, so the problem is correctness and not storage. An offer lasts roughly 5 to 30 minutes. A burst of 500 cancellations at 10 texts a second takes about 50 seconds to send, which is why the in-app offer is primary. All of these are estimates to confirm with real data.
The mistakes that cost points. Popping the next person from a memory queue, sending the message before the offer is stored, using a new key on every Accept tap, letting Accept and expiry both succeed, starting the clock when the text arrives, and keeping no record of why someone was skipped.
Frequently asked follow-ups
- How do you keep the waitlist fair?
- What happens when an offer expires?
- How do you prevent two users from accepting the same released seat?
- What if SMS arrives after the offer window is almost over?
- How do you stop bots or duplicate accounts from gaming the queue?
Deep-dive questions and strong answer outlines
How do users join the waitlist?
Store a lasting waitlist entry with the show id, user id, state, joined time, and ordering score. Use a uniqueness rule so the same person cannot join the same show many times when their phone retries the request.
What happens when capacity is released?
A promotion worker processes the release for that show in order, picks the next waiting person, creates an offer with an end time, and in the same all-or-nothing database step writes a small “please notify” outbox record. Sending the message happens afterwards, but the offer already appears in the in-app inbox.
How do you avoid double sale on accept?
Accept checks the offer is still open and not past its end time, then calls the booking service with a stable repeat-safe key (an idempotency key) so a second tap returns the same booking. Booking owns the final say on seats. If booking says the seat is gone, the offer closes and the system offers the spot to the next person.
How do you handle notification lag?
Treat email, text, and push as hints. The offer shown in the app is the real thing. Size the offer window from the slowest common delivery time plus a reasonable time to react, and measure time from offer creation to delivered on each channel.
How do you support priority users without breaking fairness?
Make the rule explicit: separate lines, score bands, or priority first and then earlier-waiter-first inside each band. Store the rule version and a reason code on every promotion so support can explain why a person moved or was skipped.
AI feedback on your design
After a practice session, InterviewCrafted summarizes strengths, gaps, and interviewer-style expectations—similar to a written debrief. See a static example report, then practice this problem to get feedback on your own answer.
FAQs
Q: Is the waitlist the same as the booking system?
A: No. The waitlist decides who gets the next chance. The booking system still owns final inventory and payment. Keeping that boundary clear prevents the waitlist from selling a seat the booking system no longer has.
Q: Should users see exact position?
A: It depends on the product. Exact position builds trust but invites gaming and creates support tickets when priority rules move people. Many systems show a band or estimated wait instead, while keeping exact order in an audit log.
Q: Can we notify several users for one seat to improve conversion?
A: You can, but then it becomes a race or lottery, not strict first come, first served. If strict fairness matters, offer one seat to one person at a time or clearly define waves with a booking lock that only one person can win.
Q: What if the user gets the SMS late?
A: The in-app offer should be the source of truth, and the window should be sized using delivery latency data. If the message arrives late, support should see when the offer was created, when each channel delivered, and why it expired.
Practice interactively
Open the practice session to use the canvas and stages, then review AI feedback.