KatInterview

Design a Seat Reservation System for Live Events

System DesignModel answer
MediumModel answerSystem Designconcurrencydistributed-systemsconsistency

Last updated

Design a distributed ticketing platform that handles high search traffic, prevents duplicate seat bookings, and survives payment service failures.

Scenario

You're building the backend for a ticketing platform where fans purchase seats for concerts, sports games, and theater shows. During on-sale windows for popular events, demand spikes dramatically — thousands of people refresh the page simultaneously and race to grab the last few seats.

Your task is to design the core reservation system that powers this platform.

Functional Requirements

  1. Users can browse available seats for an event, filtered by section, price tier, and date.
  2. A user can select a seat and initiate a purchase, which locks that seat for up to 10 minutes while they complete checkout.
  3. After the hold period, the seat is released back to inventory if payment is not completed.
  4. The system integrates with an external payment processor to finalize purchases.

Non-Functional Requirements

  • No duplicate bookings: two users must never end up with a confirmed ticket for the same seat.
  • Search must stay responsive even during traffic spikes; slight staleness in availability counts is acceptable.
  • Purchases must be durable: if a payment succeeds but an internal service crashes immediately afterward, the booking must still be recorded.

What to Cover

  1. API surface — define the key endpoints for browsing inventory, creating a hold, and confirming a purchase.
  2. Data model — propose a schema covering events, seats, hold state, and reservations.
  3. Concurrency handling — walk through exactly what happens at the database level when two users simultaneously try to claim the last seat in a section.
  4. Architecture and state transitions — describe the services involved and explain how a reservation moves from HELD to CONFIRMED given that the payment call is asynchronous and the processor may be slow or temporarily unreachable.

Hints

Hint 1

Search traffic and booking traffic have fundamentally different consistency requirements — it helps to design them as two separate paths rather than forcing a single architecture to serve both.

Hint 2

The safest way to prevent a double-booking is an atomic conditional UPDATE that checks and decrements inventory in one statement, rather than a read-then-write pattern that leaves a gap for a race condition.

Hint 3

Payment processors are unreliable and retry webhooks, so every state transition should be written as an idempotent guarded update — and a background reconciliation job should handle the case where the webhook never arrives.