Design Ticketmaster
You design most systems for an average day. A ticketing system is built for a single minute: the moment a stadium tour goes on sale and millions of fans scramble for the same few thousand seats. Unlike a URL shortener, average traffic barely registers here — the peak calls all the shots, and one slip means selling the same seat twice.
We’ll walk through this in the same order you would in an interview (the whole route is on the one-page map). Every figure comes from code running a single worked example — including a live replay of the double-booking race and your odds of landing a ticket. Use the calculator below to tweak the on-sale and watch the numbers move.
The question
“Design a ticketing service like Ticketmaster. Users browse events, choose seats and buy tickets. Popular events must survive an on-sale that everyone opens at the same moment.”
That second sentence is the whole game. Design for an average Tuesday and you’ve answered the wrong question.
1. Requirements
Functional
- Search and browse events.
- Show the seat map with availability.
- Hold chosen seats for a short time while the shopper pays.
- Take payment and issue tickets.
- Bring up, then park for later: resale and transfers, dynamic pricing, mobile entry, accounts and presale codes.
Non-functional
- Correctness first: each seat sells to one buyer, full stop. This is the one thing you never trade away.
- Survive the spike: millions of fans for a few minutes, then crickets.
- Fast, reliable browsing: the seat map can lag a few seconds behind reality, as long as it loads.
- Fairness: being first to click should not beat being a human.
Questions to ask out loud
- Reserved seats, general admission, or both?
- How big is the biggest event, and how many people join the on-sale?
- How long do we hold a seat?
- Do we need to deal with bots and scalpers?
- Do we run payments ourselves, or call a provider?
2. Estimation
Picture one stadium: 70,000 seats, 2 tickets per order, and 3 million fans hovering over the page when sales open. Your back end can handle 25,000 shoppers at a time; each spends about 5 min inside, and 50% actually check out.
Try your own on-sale
Play with the numbers. This table runs the same code that generated every figure in the article.
| Quantity | Working | Result |
|---|---|---|
| Admission rate | 25k ÷ 5 min | 83.3/s |
| Chance a fan gets tickets | 70k ÷ 2 ÷ 3M | 1.2% |
| Time until sold out | 70k ÷ (2 × 50%) ÷ 83.3/s | 14 min |
| Seats held at once, at most | 83.3/s × 2 × 3.5 min | 35k |
| Burst with no queue | 3M ÷ 1 min | 50k/s |
| Queue-page polling | 3M ÷ 10 s | 300k/s |
| Seat-map reads | 25k ÷ 5 s | 5k/s |
| Independent locks needed | 250/s ÷ (1 ÷ 10 ms) | 3 |
Admission rate is concurrent shoppers divided by session length (Little’s law). For held seats, we assume every admitted shopper grabs a hold for one order — buyers finish in 2 min, everyone else lets the 5 min timer run out. The burst assumes every fan turns up within a minute; polling assumes the queue page checks in every 10 seconds. The lock row assumes each hold keeps its lock for 10 ms, which is just a starting guess: measure yours.
That first row sets the pace for everything else. By Little’s law, if 25,000 shoppers each stay for 5 min, you can let in roughly 83.3 people a second — no faster. At that speed, the fan at the very back would wait 10 h just to get through the door. Of course, the show is gone long before then: the stadium holds 35,000 orders, giving any one fan a 1.2% shot. About 70,000 admissions do the job, and the whole thing sells out in 14 min.
Now look at what you must never send straight to the reservation service. If all 3 million fans pile in within a minute with nothing in their way, you’re throwing 50,000 requests a second at the one part of the system that cannot afford a mistake. The reservation core itself only needs to handle 250 hold attempts and 5,000 seat-map reads a second. You don’t need a monster database — you need a sturdy gate in front of a small, careful core.
Locks have their own hard ceiling. While one request holds a lock, the next one sits and waits. If each hold hangs on to its lock for 10 ms, that single lock tops out at 100 holds a second, no matter how many servers you throw at it. To hit 250 attempts a second, one lock for the whole event won’t cut it: you need at least 3 independent locks. What you choose to lock — a seat, a section or the whole event — decides how far you can scale.
For a quick reality check, look at Ticketmaster’s 2022 Eras Tour presale: they reported 3.5 billion system requests — 4 times their previous peak — even though only about 1.5 million people received presale codes. Their statement also mentions bot attacks without breaking down the numbers, so take it as an order of magnitude only. Still, the lesson stands: in a flash crowd, requests dwarf the actual invite list, so answering “am I in yet?” cheaply matters just as much as your database.
3. API
Four endpoints cover the entire journey. Split the hold from the order so the hot, contested step never waits on the slow one.
| Method | Path | Request | Response |
|---|---|---|---|
| GET | /events?q=&city=&from= | search filters | events, cached at the edge |
| GET | /events/:id/seats | optional section | seat availability (may be a few seconds old) |
| POST | /events/:id/holds | seat ids, or section and quantity | 201 with hold_id, expires_at; 409 if taken |
| POST | /orders | hold_id, payment token, Idempotency-Key header | 200 with tickets; 402 payment failed; 409 hold expired |
A hold is cheap and fast, and adding a request key makes retries safe: the first call grabs the seats, and a retry with the same key hands back that exact hold instead of tripping over seats you already own or grabbing a second batch. The order wraps payment, which is slow and must never fire twice, so it takes an idempotency key. Both endpoints can return 409 — treat that as everyday business in the UI, not a crash screen.
4. Data model
| Table | Key fields | Notes |
|---|---|---|
events | event_id, venue_id, starts_at, on_sale_at | Read-mostly. Indexed for search. |
seats | event_id, seat_id, section, row, price, state, hold_id, held_until | One row per seat per event, copied from the venue layout. The hot table. |
holds | hold_id, user_id, expires_at | Optional; seats.hold_id is enough to start with. |
orders | order_id, idempotency_key (unique), user_id, amount, status | The unique key makes retries safe. |
tickets | ticket_id, order_id, seat_id, barcode_secret | Created after payment. |
Everything revolves around seats. You store one row per seat per event, cloned from the venue layout when the event goes live. That way each show owns its own inventory — you can sell, lock and archive it without touching anything else. A 70,000-seat stadium is just 70,000 tiny rows.
That points straight to your sharding key: event_id. Every hold hits one event, which means one shard, so a stadium megashow can’t drag down a tiny club gig next door. If a single event ever outgrows one node, split by section — never by individual seat — so a request for seats side by side still stays on one machine.
Pick a boring relational database for inventory. You’re only doing a few hundred conditional writes a second: what you need is rock-solid transactions and an exact “rows affected” count, not horizontal write sharding. Keep search out of the way — stream events into a search index (like Elasticsearch) via change data capture and serve browsing from the CDN.
5. The first hard part: never sell a seat twice
The race
Your first instinct is to read the seat, check that it’s free, and write the hold. Watch what happens when two buyers do that at once:
Two buyers, one seat
Check, then write
| Step | Buyer | Statement | Result | Seat afterwards |
|---|---|---|---|---|
| 1 | A | SELECT state | available | available |
| 2 | B | SELECT state | available | available |
| 3 | A | UPDATE … SET state = held | ok | held by A |
| 4 | B | UPDATE … SET state = held | ok | held by B |
Both buyers (A and B) get told the seat is theirs — even though only one can actually hold it.
One conditional update
| Step | Buyer | Statement | Result | Seat afterwards |
|---|---|---|---|---|
| 1 | A | UPDATE … WHERE state = available | 1 row updated | held by A |
| 2 | B | UPDATE … WHERE state = available | 0 rows updated | held by A |
Only buyer A gets the seat. The other hears straight away that it’s gone.
Nothing exotic here, and every single-user test goes green. Both buyers read “available” because neither write had landed yet. To kill the race, collapse “check” and “claim” into one atomic step with a conditional update: the database checks the condition and writes in one breath, then tells you how many rows changed.
UPDATE seats
SET state = 'held', hold_id = :hold, held_until = now() + :ttl
WHERE event_id = :event AND seat_id = :seat
AND (state = 'available' OR (state = 'held' AND held_until < now()))
One row updated means the seat is yours. Zero means someone beat you to it — tell the shopper and let them pick another. That second clause also lets you take over an expired hold on the spot, without waiting for a background cleanup job.
Five ways to claim a seat
| Approach | How it works | Good | Bad |
|---|---|---|---|
| Read, then write | Select the state, check it in the app, then update. | Passes every single-user test. | Two buyers can both pass the check. Never ship it. |
| Row lock | SELECT … FOR UPDATE inside a transaction, then update. | Correct and familiar. | You hold the lock across network round trips, so waiters pile up on the best seats. |
| Conditional update | One UPDATE … WHERE state = available; the rows-affected count says who won. | Correct, one statement, no lock between round trips. | You have to tell losers it’s gone and offer other seats. |
| Distributed lock | SET key NX PX ttl in Redis before touching the seat. | Fast, works across stores. | Not the source of truth: a paused client outlives its lock. Needs a fencing token or the database check anyway. |
| Server picks the seats | The shopper asks for N seats in a section; the server claims them with FOR UPDATE SKIP LOCKED. | Removes pick contention almost entirely. | Less choice for fans, and adjacency logic to write. |
Watch out for Redis locks — they’re the first thing most candidates reach for. A TTL lock can expire while its holder is frozen by a long GC pause or a flaky network, leaving two clients convinced they both own the seat. A lock makes collisions rarer; the conditional write in your database makes them impossible. If you use Redis at all, put it in front of the database check as an optimisation, never in place of it.
The granularity of your lock sets the ceiling we worked out in section 2. One lock per event caps you at 100 holds a second. Locking by section multiplies that by the number of sections. A per-seat conditional update serialises only the buyers fighting over the exact same chair.
If you do put a lock in the path, get three details right. First, commit the write before you release the lock — otherwise the next waiter reads stale data and the lock bought you nothing. Second, don’t let every waiter hammer the lock store: queue them locally inside each server so only the head of the queue checks, cutting lock-store traffic by orders of magnitude. Third, keep a database unique constraint underneath as the final referee, because any lease without a fencing token breaks the moment a client stalls past its expiry.
One more trap: tie uniqueness to the physical chair. If your unique constraint sits on (price tier, seat), you can sell the exact same seat once as Adult and once as VIP without even triggering a race. A chair belongs to an event, not a price tier — keep price as an attribute and put uniqueness on (event, seat).
Holding several seats at once
An order of 2 seats is an all-or-nothing deal. Claim the whole group in one transaction — or in a single conditional update that checks every requested seat — and roll back if even one is gone, so nobody ends up with half a pair. If you lock rows, always lock them in a fixed order (say, by seat id) so two buyers grabbing overlapping seats can’t deadlock each other. Finalising the order plays by the same rule: every seat flips from held to sold together, or none does.
Holds and their life cycle
A hold is simply a seat in the held state with a ticking clock. It buys the shopper time to type in a card number without losing their spot, and automatically hands the seat back if they walk away.
| From | To | Trigger |
|---|---|---|
| available | held | A hold request wins the conditional update |
| held | available | The hold expires, or the shopper leaves |
| held | sold | Payment succeeds while the hold is still ours |
| sold | available | Refund or cancellation (a business rule, not a race) |
Don’t spin up a timer for every seat. Just treat an expired hold as free whenever someone reads or claims it — exactly like the SQL above — and run a background sweeper to keep the seat map tidy. If a reservation server dies mid-sale, you don’t have to repair a thing: its holds quietly expire on schedule. The deadline is your recovery plan.
Call out one side effect in the interview. With our admission rate, a 5 min hold across 70,000 seats can pull up to 35,000 seats off the map at once while shoppers fumble for their wallets. That’s why fans watch seats vanish and pop back up minutes later. Shorten the hold and seats recycle faster, but slow payers lose their cart; lengthen it and you’re kinder to buyers, but more inventory sits frozen. It’s a product trade-off with a real number behind it.
Contention
Even rock-solid writes still leave people empty-handed. Suppose 1,250 shoppers click on the same snapshot of the seat map before it refreshes — here’s what share of those clicks lose the race.
| Where fans click | Every seat free | Late in the sale (10% free) |
|---|---|---|
| Spread evenly over the hall | 0.89% | 8.4% |
| Crowded on the best seats | 41% | 53% |
Almost everything comes down to where fans aim. Spread clicks evenly across an empty hall and collisions barely happen. Pile everyone onto the front rows and a huge chunk of clicks lose even when the whole arena is open — and it only gets rougher late in the sale as seats dwindle. The cheapest fix isn’t more hardware, it’s a product call: offer “best available” and let the server pick. Shoppers ask for a count in a section, and the server grabs seats with SKIP LOCKED instead of queueing everyone behind one hot row. Save the manual seat map for quieter shows.
6. The second hard part: the waiting room
A reservation core built for 250 attempts a second will fold under 50,000 requests a second. Scaling the database for that peak makes no sense: the stampede lasts minutes, and you’d pay for idle servers the rest of the year. Put a gate out front instead and let people in only as fast as the core can comfortably serve them.
Be clear about why the waiting room exists: it protects the core from falling over. Measure your core first. If trimming the critical section or shrinking the locked unit buys you enough headroom, do that before building a queue — a waiting room never speeds up the core, it only organises who waits. Reach for the gate once realistic peak demand still dwarfs your measured ceiling, and switch it on per event: nobody wants to sit in a queue for a 40-seat workshop.
What the queue promises
| Place in the queue | Admitted after | Outcome |
|---|---|---|
| 1,000 | 12 s | Gets in |
| 10,000 | 2 min | Gets in |
| 70,000 | 14 min | Gets in |
| 500,000 | 1.67 h | Sold out before their turn |
| 3,000,000 | 10 h | Sold out before their turn |
Show fans this honest picture. Only places up to roughly 70,000 really count; people who never come back for their turn push that line a little further. A thoughtful queue page is upfront about it: it gives a real wait estimate and, the second tickets run out, tells everyone left in line straight away instead of keeping them on the hook for 10 h just to hear “sold out”.
How to build it
- Serve it from the edge. The waiting-room page is static. Let a CDN or edge worker answer it so 300,000 polls a second never even touch your origin.
- Randomise, don’t race. Open a lobby before the sale and drop everyone inside at the start into a shuffled order; later arrivals queue behind them in arrival order. That stops the fastest fibre line or slickest bot from sweeping the front rows, and kills the urge to hammer refresh.
- Admit with a signed pass. When a shopper reaches the front, the gate hands them a short-lived HMAC-signed token. The pass is bound to the account and session, and the reservation API checks the signature locally with zero database calls; only one-use and per-buyer limits need real state. No pass, no hold. Leave browsing and the seat map open — they’re cached reads. Always gate the write, never the read.
- Admit per buyer, not per request. A single shopping session can fire several hold calls; count requests and one cart burns through multiple admissions.
- Steer the rate with live feedback. Don’t hardcode the admission rate. Open the tap while the hold path stays snappy and throttle back the moment latency creeps up, capping out at 25,000 shoppers. Admission is the backpressure valve for the entire system.
- Poll politely. Have clients check in every 10 seconds with random jitter, and make what they ask for one shared status object, the same for everyone, so the CDN answers it and the origin barely notices. Pushing over Server-Sent Events suits the shoppers already inside; for a queue of hundreds of thousands, an open connection each costs more than a cached poll.
- Make botting expensive. Combine verified presales (one code per registered fan), caps per account and payment card, proof-of-work or a challenge at the gate, and rate limits tied to the pass rather than IP. None of these is a silver bullet, but stacked together they ruin the bot operator’s margins.
- Plan your fallback mode. If the queue’s own store goes down, keep honouring passes already in the wild — they verify locally anyway — and pause new admissions until it comes back. A trickle is safe only with a small budget allocated globally in advance; every edge node letting in a few adds up to a rate nobody chose. Flung wide open, the gate stops protecting your core; a short pause only delays the next fans while everyone inside keeps buying. (Of course, neither option saves you if the inventory database itself goes down.)
With a waiting room in place, the hardest part of the system — claiming seats cleanly — runs at a pace you picked, not whatever the internet throws at you. How to build one for five million people, with a draw nobody can rig and a status the CDN answers for everyone, is in the 300,000-ticket walkthrough.
7. Payment, and the architecture
- Browse and seat map (read path)
- Hold and buy (write path)
- After the sale, asynchronous
Taking a seat
- The fan browses freely. The moment they go to grab seats during a gated on-sale, the waiting room issues a signed admission pass.
- The seat map comes from an availability cache refreshed every few seconds. It’s allowed to be slightly stale; the hold never is.
- The fan picks seats, and the reservation API runs the conditional update — handing back either a timed hold or a
409. - The fan pays. The order request brings an idempotency key backed by a unique constraint on the orders table.
- Once payment clears, a single conditional write flips the seat from
heldtosoldafter verifying the hold is still ours. The sale and an outbox row commit in the same transaction; a background relay pushes that event to the bus — retrying until it sticks — so a crash right after checkout can never leave a paying fan ticketless. Ticket issuing is idempotent on the order id, and none of it blocks the HTTP response.
Idempotency and the slow payment
Payments love to fail halfway through: a timeout right after the card is charged, an impatient double-click, a retry on shaky mobile data. Have the client send one idempotency key per purchase attempt. See that key twice and you hand back the original outcome instead of charging again — and pass the exact same key straight through to the payment provider.
The nastiest edge case is a payment that finishes after the hold expires: the card gets charged, but the seat has already gone to someone else. Pair two defences here. First, grant a short, bounded grace extension the moment payment starts so an ordinary slow charge never loses its seat. Second, if money still settles after the seat is gone, refund automatically and tell the fan straight up. Never quietly double-sell just to make the books balance.
Model the order as a small state machine (pending, paid, failed, refunded) driven by provider callbacks, and make every transition safe to replay. It’s the same mindset as holds: always decide up front what happens when the same message lands a second time.
8. Bottlenecks and follow-ups
General admission
No seat numbers here, just a pool count. The same atomic trick works on a counter: UPDATE tiers SET remaining = remaining - :n WHERE remaining >= :n either succeeds or fails cleanly. If one hot counter row turns into a bottleneck, split the quota across several counter rows and subtract from a random shard.
At festival scale this stops being a quick follow-up: Ticketing for a 300,000-place event walks through quota ownership, multi-day passes, payment-provider bottlenecks and scanning people in on the day.
The seat map is read far more than it is written
You’re looking at 5,000 reads a second all pounding the same few thousand rows. Serve them from a cache keyed by event and section — refreshed every few seconds from the database — or push tiny availability diffs to open browsers. A stale map only costs one 409 and a quick re-pick, which is dirt cheap.
Search and browsing
Event pages and search results barely move. Tuck them behind a CDN with short TTLs and keep them completely off the reservation path, so a wave of window-shoppers never slows down people checking out.
Resale and transfers
Now a ticket has a real owner. On transfer, invalidate the old ticket and issue a fresh barcode secret; rotate barcodes on the phone screen so a screenshot won’t get anyone past the gate. A resale listing follows the exact same hold-then-confirm dance.
Several regions
Pin each event to a home region that owns its inventory writes, and replicate reads outward to fans. Running cross-region consensus on every seat click costs far more latency than it’s worth.
Failure, in order of how often it happens
- A reservation server crashes: its holds expire on their own, no cleanup needed.
- The seat-map cache is stale: a few shoppers see a
409and pick again. - The payment provider drags its feet: the order stays pending and the hold gets a bounded grace extension.
- The queue service gets swamped: the edge keeps serving the last status, shoppers already inside keep buying, and new admissions pause until it recovers.
The last two minutes
- Average traffic barely matters — the on-sale calls the shots. Design for the 50,000 requests a second spike, not the daily mean.
- Park a waiting room at the edge and let shoppers in at the pace your core can handle (83.3 a second here), using signed passes and live feedback control.
- The core itself is tiny — around 250 hold attempts a second. Pour your engineering effort into correctness, not horizontal scale.
- Claim seats with a single conditional update, shard by event, and never bet correctness on a lock alone.
- Holds expire on a deadline — and that deadline doubles as your self-healing mechanism.
- Send an idempotency key with every payment. If a charge clears after the hold expires, refund automatically and tell the buyer plainly.
- Let the read side be stale and the write side be exact.