Design a Ticket Booking System (Ticketmaster)
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Other
Design a ticket booking system like Ticketmaster. Users search for events, pick specific seats on a seat map, hold those seats for a short time while they pay, and then check out securely. The hard case is a popular on-sale, when far more people than there are seats try to buy the same inventory at the same moment.
The system must support:
1. Search and view: users search for events by artist, location or genre and view an event's details.
2. Seat selection: users see a seat map and select specific available seats.
3. Booking (reservation): users temporarily hold the selected tickets while they go to payment.
4. Payment and confirmation: users pay for the held tickets to confirm the booking.
```hint Two kinds of traffic
Split the system into a browsing path and a buying path, and decide separately how fresh and how correct each one has to be.
```
```hint The contested state
Find the single piece of state two buyers can fight over, and ask what must be true about it at every moment.
```
### Constraints & Assumptions
- Reserved seating, with venues up to stadium size (about 50,000 seats per event).
- A high-demand on-sale can bring more than 1 million concurrent users.
- Browse pages should load in under 300 ms.
### Clarifying Questions to Ask
- Is all seating reserved, or do some events sell general admission by quantity?
- How long should a hold last before the seats go back on sale?
- Is there a limit on how many tickets one buyer can hold or buy per event?
- During an on-sale, must buyers enter the booking flow strictly in arrival order?
- Are cancellations, refunds, resale and ticket delivery in scope?
### Part 1 — Requirements and core entities
State the non-functional requirements and name the core entities with their key fields. Say where the system can favor availability and where it must stay strictly consistent, and turn the scale above into rough read and write rates.
```hint A seat at an event
A venue's physical seats exist once, but every event sells them again. Think about which record holds the per-event state.
```
#### What This Part Should Cover
- Consistency and availability choices made per path, with uptime and latency targets
- Peak read and write rates and a fairness requirement for the on-sale
- The entities, including how a physical seat relates to its sale for one event, and the status fields that drive the booking flow
### Part 2 — API and high-level design
Define the main endpoints with their payloads, then sketch the components and how a request moves through them when a user browses and when a user buys.
```hint Seat map payload
A stadium map has tens of thousands of seats. Separate the part of the map that never changes from the part that changes every second.
```
#### What This Part Should Cover
- Endpoints for search, event details, seat availability, reserving seats and paying
- How the seat map and live availability reach the client without a database read per view
- The components on the read path and the write path, and the store behind each one
### Part 3 — Preventing double booking
Two users see the same seat as available and both click Reserve at the same moment. Explain the mechanisms and components that make sure only one of them gets it.
```hint Two layers
Consider what the database alone can guarantee, and what a fast check in front of it buys you when thousands of requests target the same seats.
```
#### What This Part Should Cover
- The race condition and why reading the status and then writing it is unsafe
- A transactional guarantee in the database that holds even when every other layer fails
- A fast guard in front of the database, and how it is acquired and released for multi-seat orders
### Part 4 — Absorbing a massive traffic spike
Millions of users arrive for an on-sale, and the booking path can serve only a few hundred new buyers per second. Explain the components involved and how they work together to absorb the spike fairly.
```hint While they wait
Consider where users sit while the booking path is full, and what each waiting client asks your servers for in the meantime.
```
#### What This Part Should Cover
- How arrivals are ordered and how that order is preserved
- How waiting clients learn their status without loading the backend
- How the admission rate is controlled and how the booking path checks that a user was admitted
### Part 5 — Expiring abandoned holds
Many users hold seats and then abandon checkout. Explain step by step how the system notices expired holds and releases the seats so other buyers see them again.
```hint Two ways to notice
An expired hold can be discovered when someone next touches the seat, or a timer can fire when it lapses. Ask what each approach misses on its own.
```
#### What This Part Should Cover
- How a reservation treats a seat whose hold has already lapsed
- A timer-driven release that updates both the database and the seat map
- What happens when a payment completes at the moment the hold expires
### What a Strong Answer Covers
- Strict consistency for seat inventory and availability-first choices for browsing, each tied to a concrete mechanism
- Separate read and write paths sized to the stated scale
- A double-booking defense whose final guarantee sits in the database
- A fair, rate-limited admission scheme for on-sale spikes
- A hold lifecycle with expiry, cleanup and a safe interaction with payment
### Follow-up Questions
- How would you add general admission sections, where buyers choose a quantity of tickets with no seat assignment?
- How would you keep one hot event from overloading a single database shard or Redis node?
- How would you stop bots from repeatedly holding seats to keep them off the market?
Overview: Design an online ticket booking system where users search for events, choose specific seats on a seat map, hold them briefly and pay. It tests how you prevent double booking under heavy concurrency, absorb on-sale traffic spikes fairly, and release abandoned holds so the seats go back on sale.