How to design Ticketmaster
The first sections are free. The deep dives, level expectations and quiz are part of Pro.
On this page
The problem
A ticket site shows events, lets a buyer pick seats on a map and takes their money. The hard part is that millions of people browse one popular event while a much smaller group tries to buy, and that smaller group wants the same seats in the same moment. The answer turns on two moves: a short hold on each chosen seat, with a time limit, so a buyer can pay without the seat being sold under them, and a gate in front of the booking path for the biggest on-sales so buyers reach the seat-hold store in batches rather than all at once.
Clarifying questions
| Ask | Why it matters | A typical answer |
|---|---|---|
Are seats assigned, or is it general admission? | Assigned seats create a race on each seat, which is the whole booking problem. General admission is a single counter per event and a much smaller question. | Assigned seats: a buyer picks specific seats on a venue map and books those. |
How big is the biggest on-sale, and how do views compare with bookings? | It tells you whether the read path needs a cache and whether the booking path needs a gate in front of it. | About 10 million users on one popular event the moment sales start, with reads outnumbering bookings about 100 to 1. |
How long may a buyer hold seats while paying? | The hold length sets the time limit on the seat hold and decides how long an abandoned cart keeps a seat off the market. | Seats are held for 10 minutes; after that they go back on sale. |
Who takes the payment? | With an outside processor whose hosted fields take the card, we handle holds and confirmation, not card data, and it introduces a callback we have to make safe to repeat. | A payment provider such as Stripe. We create the payment and confirm the booking when the provider tells us it went through. |
Does search have to cope with typos, and how fast must it answer? | A typo-tolerant search usually means a search index outside the main database, which is a trade-off worth naming early. | Yes: a misspelled artist name should still find the event, and results should come back in under 500 ms. |
Does the seat map have to update live for everyone? | A live map for millions of viewers is expensive, and for the biggest events it may be worth giving up. Knowing the expectation early lets you say so later. | The map must be viewable. How live it is for the biggest events is your call; say what buyers lose if it isn't. |
Are past bookings, event administration and pricing in scope? | Each can be built apart from booking, and naming them as out of scope saves time for the booking path. | No. Viewing past bookings, admins adding events and dynamic pricing are all out of scope. |
Non-functional requirements
| Requirement | What it forces |
|---|---|
No seat is ever sold twice: consistency for booking | One place decides who gets a seat, and it must decide atomically: a set-if-absent on a seat key, or a conditional update on the ticket row. The final transition to sold happens inside a transaction in the main database, so a lost hold still ends with one winner. |
Availability for browsing and search | Event, venue and search reads come from caches and a separate search index, so they keep answering when the booking path is saturated or the payment provider is slow. Stale by a little is acceptable here; down is not. |
About 10 million users on one popular event | The event page for that one event must be served from cache and from stateless servers behind a load balancer, and the booking path needs a gate that admits buyers in batches, because millions of hold attempts on one event's seats would overwhelm any single decision point. |
Search answers in under 500 ms | No table scan on the request path. Search runs against an index built for text, and the most common queries are cached, since the same artist name is typed again and again while an on-sale runs. |
Reads outnumber bookings about 100 to 1 | Split the read side (event and search services) from the write side (booking) so each scales on its own, put the caching effort on the read side, and spend the correctness effort on the much smaller write side. |
Estimates
| Quantity | Working | Result | What it sizes |
|---|---|---|---|
Share of requests that are reads | With 100 reads for each write, 100 ÷ 101 ≈ 99% of requests are reads | About 99% of requests are reads | The event cache: if it answers the reads, the events database sees roughly one request in a hundred, and the booking path is a small fraction of the traffic. |
Booking requests the ratio implies at the on-sale | 10 million viewers ÷ 100 reads per write ≈ 100,000 booking requests over the on-sale, as a rough order of magnitude | On the order of 100,000 booking requests against 10 million page views | The booking path: far smaller than the read path, but all of it lands on one event's seats, which is why it needs a gate rather than more servers. |
Seconds in a 10-minute hold | 10 minutes × 60 seconds a minute = 600 seconds | 600 seconds | The |
How long a cleanup job that runs once a minute can leave a free seat shown as taken | A hold that lapses just after one run stays marked reserved until the next: up to 60 seconds, which is 60 ÷ 600 = 10% of the hold itself | Up to 60 seconds, a tenth of the hold | The cost of freeing seats with a scheduled job instead of reading the expiry on the way out, and the reason a lapsed hold should be treated as free the moment it lapses. |
Batches of admitted buyers inside booking at once | Each admitted buyer gets up to 10 minutes; admitting a batch each minute means 10 ÷ 1 = ten batches overlap | About ten batches active at any moment | The admitted set in Redis, and the batch size: the number of buyers the booking path can serve at once, divided by ten. |
Core entities
| Entity | What it holds |
|---|---|
Event | One performance at one venue on one date, with the tickets that belong to it. |
Venue | The place, its capacity and the seat map the event page draws. |
Performer | The artist or team; its name is one of the things people type into search. |
Ticket | One seat at one event. Its status is the thing two buyers race over. |
Booking | One purchase attempt by one user for a set of tickets, from in progress to confirmed. |
Seat hold (Redis key) | A key per ticket id, written with a set-if-absent, that expires on its own after the hold time. |
The API
| Endpoint | Notes |
|---|---|
| Event, venue and performer are served from a cache with a long lifetime, because they rarely change. The tickets list carries each seat's status and is cached for a short time or, for ordinary events, kept current over a server-sent event stream. For the biggest on-sales, this call is answered from cache for everyone and the live map is dropped. |
| Goes to the search service, which queries a search index that tolerates typos in the name and performer and filters on the date range. Common queries are cached. Results may lag the main database by the replication delay, which is acceptable for discovery. |
| The user comes from the session, not the body. The booking service tries to hold each ticket id with a set-if-absent and a time limit; if any seat is already held it releases the ones it took and returns |
The high-level design
Step 1 of 4
Browse and book through one gateway
Start with the two jobs the requirements name. An API gateway in front handles sessions and rate limits and routes to an event service for GET /events/{eventId} and a booking service for POST /bookings/{eventId}. Both read and write one relational database that holds events, venues, performers, tickets and bookings; a ticket row carries the seat's status. The booking service runs its writes in transactions, so a sale changes the ticket and creates the booking together or not at all. This is enough to sell a ticket to one buyer at a time. It has no answer yet for two buyers who want the same seat while one of them is still typing a card number.
What breaks first
The deep dives
Holding seats during checkout. Two buyers click the same seat in the same second and both start paying. What stops the seat from being sold twice, what does each buyer see, and what happens if a hold runs out while a payment is still being processed?
A huge on-sale. Ten million people open one event the second sales start. What does each part of the design see, which part fails first, and how do you let buyers through without the booking path collapsing?
Fast search. Someone types an artist's name with a typo and expects results in under half a second. Where does the query run, how does the index learn about a new event, and what does that choice cost?
Concepts this guide uses
Sources
- Redis documentation: SET
- Redis documentation: ZRANK
- PostgreSQL documentation: Explicit Locking
- PostgreSQL documentation: Full text search, tables and indexes
- Elasticsearch reference 8.19: Fuzzy query
- Debezium documentation: Debezium connector for PostgreSQL
- MDN: Server-sent events
- MDN: Using server-sent events
- Stripe documentation: Receive Stripe events in your webhook endpoint
- Ticketmaster help center: What is the queue and how do I join?
- NBC News: Ticketmaster says Verified Fan registration doesn't measure fandom
- System Design School: Ticketmaster (ticket booking) system design
- DEV Community: Design Ticketmaster, the system design interview walkthrough