System design case study C11 · Concurrency · Saga

Design a Ticket Booking System (BookMyShow-style)

Thousands of people want the same seats at the same second. The whole design is about holding seats fairly, never selling one twice, and surviving the rush when a blockbuster opens.

What you'll be able to explain
  • Model shows, seats and holds
  • Prevent double booking with constraints and conditional writes
  • Implement temporary seat holds with expiry
  • Coordinate booking and payment with a saga
  • Use a virtual waiting room for extreme demand

Scope

Functional

  • Browse movies/events, cities, venues, shows; view a live seat map.
  • Select seats → temporary hold (e.g. 8 minutes) → pay → confirmed booking with ticket.
  • Cancellation per policy.

Non-functional

  • Never double-book a seat. Holds expire reliably.
  • Seat map freshness within a few seconds.
  • Survive "first day first show" spikes: 1M users trying to book within minutes.

Size

  • 1M bookings/day on average; peaks of 50k booking attempts/s for blockbuster openings.
  • Seats per show ~300; shows per day ~100k → 30M seat-show rows per day: manageable, partitioned by show.

Data model

Table Key Notes
shows show_id movie, screen, start time, pricing
show_seats (show_id, seat_id) status: AVAILABLE / HELD / BOOKED, hold_id, hold_expires_at, version
holds hold_id user, show, seats, expires_at, status
bookings booking_id user, show, seats, payment_id, status

Partition show_seats by show_id: a booking touches one show, so it's a single-partition transaction.

The architecture

CLIENTUserNETWORKWaiting roomfor hot showsSERVICECatalog / showscachedSERVICEBooking serviceDATABASESeats DBSQL, by show_idCACHESeat map cacheper showEXTERNALPayment gatewayWORKERHold expirerhot showadmittedbrowsehold seats (txn)payupdaterelease expired
Booking flow: seat holds are strongly consistent; browsing is cached.

The 30-second summary

Say it in the interview

"Seat state lives in a relational store partitioned by show. Holding is a single conditional UPDATE in a transaction, all-or-nothing on the seat set, with expiry; a unique constraint on bookings guarantees no double sale. Payment runs as a saga keyed by the hold ID, with auto-refund if the hold lapses. Hot releases go through a virtual waiting room, and the seat map is a cached, slightly stale view."

Follow-up questions the interviewer may ask

  1. How do you show a live seat map to thousands of people?
  2. What if a user holds seats and never pays?
  3. How do you handle a blockbuster opening with 1M users at once?
  4. What if payment succeeds after the hold expired?

Model answers to each of these are in the book.