Use case · Mobility & booking
Ticket drop waiting room
Tickets go on sale and fans and bots arrive at once. Watch one fan buy a seat, a stampede expire held seats mid-checkout, then a fair queue admit by arrival time.
Used by apps like Ticketmaster, Eventbrite, See Tickets, AXS and DICE
Happy path · break it · fix it
Ticket drop waiting room: sequence diagram
Ticket drop waiting room, shown as messages between Fan (A fan's browser or app. In the crowded modes it also stands for bots), Edge (The edge servers in front of the site, where the waiting room page is served), Queue (The queue service that decides how many people may enter per minute and whose turn it is), Seats (The seat inventory service that holds a seat for one cart for a limited time), Payments (The payment provider that charges the card).
Happy path: 8 steps.
- Fan → Edge: GET /event. An ordinary on-sale with light demand: one fan opens the event page.
- Edge → Queue: room?. The edge asks the queue service whether the site has room for one more buyer.
- Queue → Edge: go in (reply). There is plenty of room, so the fan goes straight in without seeing a waiting page.
- Fan → Seats: hold seat 14C. The fan picks seat 14C, and the seat is set aside for this cart for eight minutes.
- Seats → Fan: held for 8:00 (reply). Nobody else can take 14C while the timer runs, and the fan sees the countdown.
- Fan → Payments: pay for 14C. The fan enters card details and pays, well inside the eight minutes.
- Payments → Seats: paid. The payment lands while the hold is still running, so the hold becomes a sold ticket.
- Seats → Fan: ticket 14C (reply). The fan gets the ticket, and seat 14C is gone from the seat map for good.
Result: One fan, one held seat, one payment inside the hold, one ticket.
Break it: 10 steps.
- Fan → Edge: GET /event (many at once). A big on-sale opens, and fans and bots all arrive in the same second.
- Edge: no line: all go in. There is no working queue, so the edge lets every arrival through and records no order.
- Edge → Seats: hold seat (many at once). The seat service is flooded with hold requests from the whole crowd at once.
- Seats → Fan: held for 8:00 (reply). One cart is granted seat 14C, and its eight-minute clock starts now.
- Fan → Payments: pay for 14C (never arrives). Checkout pages crawl under the flood, so this fan cannot reach payment in time.
- Seats: hold ran out: 14C free. The hold runs out in the middle of checkout, and seat 14C drops back into the pool.
- Seats → Fan: cart expired (reply). The fan who had the seat in hand gets an error and an empty cart.
- Fan → Edge: refresh (many at once). Fans refresh; with no saved place, each refresh is a new arrival behind the latest wave.
- Edge → Seats: hold seat (many at once). The next wave grabs the freed seat, so a bot that came later can win it.
- Seats → Fan: 503 (reply) (many at once). The fans who arrived first see errors, and the same seats keep changing hands.
Result: Seats bounce between carts that cannot pay; arrival order counts for nothing.
Fix it: 10 steps.
- Fan → Edge: GET /event (many at once). The same on-sale, the same crowd, the same second.
- Edge → Fan: pass 10:00 (reply) (many at once). The edge stamps each arrival's first minute into a signed cookie: that stamp is their place.
- Queue: admit 2 per minute. The queue admits a set number per minute, oldest arrival minute first; the third fan sees a position.
- Edge → Seats: hold seat (many at once). Only the admitted fans ask for seats, which is a load the seat service can carry.
- Seats → Fan: held for 8:00 (reply) (many at once). Each gets a seat on a timer that is set longer than checkout takes on a busy day.
- Edge → Fan: still 3rd (reply). The waiting fan refreshes; the cookie still carries the first arrival time, so the place is kept.
- Fan → Payments: pay for 14C. Checkout is quick with so few people inside, and the fan reaches payment with minutes to spare.
- Payments → Seats: paid. Payment completes inside the hold, so the seat is sold and never bounces back.
- Seats → Fan: ticket 14C (reply) (many at once). Both admitted fans leave with tickets, which frees two places inside.
- Edge → Seats: hold seat. The next minute the third fan is admitted, in the order they arrived and as they were told.
Result: First come, first served: every hold outlives its checkout.
step 1 of 8
An ordinary on-sale with light demand: one fan opens the event page.
- request
- success
- held / reserved
At scale
One fan never shows this failure. Turn up the crowd and compare: with no queue, holds expire unpaid; with steady admission, seats sell while the rest wait. All numbers are illustrative.
Numbers are illustrative: a small simulation, not a measurement.
The happy path, step by step
- A fan opens the event page.
- The edge asks the queue service whether the site has room for another buyer.
- Demand is light, so the fan is let straight in and never sees a waiting page.
- The fan picks a seat, and the seat service holds it for that cart for a fixed time, for example eight minutes.
- The fan sees the seat and a countdown; nobody else can take the seat while it runs.
- The fan pays.
- The payment arrives while the hold is still running, so the hold becomes a sold ticket and the timer stops.
- The fan receives the ticket.
The failure
What breaks and why
A big on-sale is a crowd that arrives in one second, and part of it is bots. With no working queue, everyone is let straight through, so the seat service gets every hold request at once and the pages behind it slow to a crawl. Holds are still granted, but to carts that cannot reach payment before the timer ends; the hold expires mid-checkout and the seat drops back into a pool that the next wave grabs. Nothing records who came first, so a refresh sends a fan to the back, later arrivals jump ahead, and the fans who waited longest get the errors.
Before / after
The fix
Decide at the edge who goes in and when. Give every arrival a place based on the minute they first arrived, kept in a signed cookie, so a refresh or a second tab changes nothing. Admit a fixed number per minute, oldest arrival minute first, sized to what the seat service and checkout can carry, and show everyone else an honest position and wait. Then set the seat hold longer than checkout takes at that admission rate, so a hold that is granted can always be paid for.
on request(req):
# no record of who came first
return forward(req, seat_service)
# a refresh is a brand-new arrival
# load on seats = size of the crowdon request(req):
t = verify(req.cookie) or stamp(minute(now))
if t.admitted:
return forward(req, seat_service)
# oldest arrival minute first, N per minute
if t.bucket <= now_serving() and take_slot(N):
t.admitted = true
return forward(req, seat_service, sign(t))
ahead = waiting_before(t.bucket)
return waiting_page(sign(t),
position = ahead, wait = ahead / N)
# seat hold must outlast checkout at rate NBoss fight
Diagnose the real outage
The real outage
Based on the company's statement3.5 million fans registered for one presale. On the day, traffic was four times anything the site had seen, and carts were emptying at checkout. More sales were due to open. What would you do?
Fight the boss90 seconds · the company is revealed after you answer
From their own write-ups
How real companies approach it
Cloudflare describes giving each Waiting Room visitor an encrypted cookie with a one-minute bucket for their first visit, and handing free places to the oldest buckets first. Places are split between data centres by each one's share of traffic two minutes earlier, which risks a small overshoot when traffic data arrives late.
Cloudflare: Building Waiting Room on Workers and Durable Objects ↗Shopify says its first checkout throttle used random polling and gave no preference to buyers who had queued early. Its fair queue stores each buyer's first-attempt timestamp in a signed cookie, and every load balancer works out its own “now serving” threshold, so no shared data store is needed.
Shopify Engineering: Surviving flashes of high-write traffic using scriptable load balancers, part II ↗Ticketmaster says in its statement on the Eras Tour presale that Verified Fan asks fans to register first, that only verified accounts could enter a queue, and that buyers also had to enter a unique code to complete a purchase.
Ticketmaster Business: Taylor Swift | The Eras Tour onsale explained (company statement, 19 Nov 2022) ↗
How this comes up in interviews
"Tickets for a stadium show go on sale at a fixed time, and fans and bots arrive together. Design the path from the event page to a paid ticket."
Then they ask
- A fan refreshes the page or opens a second tab while waiting. What happens to their place?
- How do you choose the admission rate and the length of the seat hold together?
- The queue is enforced at many edge locations. How do they agree on who is next without a shared database?
A strong answer covers
- Decide at the edge who goes in and when, before the seat service sees the crowd.
- A place is based on first arrival and kept in a signed cookie, so a refresh or a second tab changes nothing.
- Admit a fixed number per minute, oldest arrivals first, sized to what the seat service and checkout can carry.
- Show everyone else an honest position and wait.
- Set the seat hold longer than checkout takes at that admission rate, so a hold that is granted can always be paid for.
Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.
Your turn
What would you do?
Tickets for a stadium show go on sale at 10:00. Fans who arrived at 10:00 are still refreshing at 10:20 while people who arrived at 10:15 are buying, and many carts expire on the payment page. Which change removes the cause?
Related
Ticket drop waiting room questions
- How does a virtual waiting room keep the queue fair?
- It records when each visitor first arrived, usually in a signed or encrypted cookie, and lets people in oldest first at a rate the site can carry. The place travels with the browser, so refreshing or reconnecting does not move anyone back, and arriving later never puts anyone ahead.
- Why do tickets disappear from my cart during checkout?
- A seat in a cart is only held for a few minutes. If the site is overloaded and payment cannot finish before the hold ends, the seat is released and someone else can take it. A waiting room prevents this by letting in only as many buyers as can finish checkout inside the hold.
- How long should a seat hold last?
- Longer than checkout takes for nearly every buyer at the rate you admit them, and no longer. A hold that is too short expires while people are paying. A hold that is too long keeps abandoned seats off sale while fans in the queue are told nothing is left.
Sources: Cloudflare: Building Waiting Room on Workers and Durable Objects ↗ · Shopify Engineering: Surviving flashes of high-write traffic using scriptable load balancers, part II ↗ · Ticketmaster Business: Taylor Swift | The Eras Tour onsale explained (company statement, 19 Nov 2022) ↗ · Report a problem
A typical design, informed by public write-ups, not any one company's exact system. Diagrams are our own. Numbers in the simulation are illustrative. All wording is original and paraphrases the linked sources.