KatInterview

Designing a Scalable Concert Ticketing System

System DesignModel answer
MediumModel answerSystem Designdistributed-systemsconcurrencytransactions

Last updated

Build the backend for a live event ticketing platform that prevents overselling during high-traffic on-sales while managing seat reservations and payments.

You're tasked with architecting a ticketing platform for live events like concerts and sports games. The system must handle extreme load during popular event launches while guaranteeing that no seat is ever double-booked.

Core Functionality

Your platform needs to support:

  • Real-time seat browsing: Users see which seats remain available and their prices
  • Time-limited reservations: Selected seats are locked exclusively for a customer (typically 10 minutes) during payment
  • Payment processing: Handle credit card transactions that may fail, timeout, or complete after the reservation window
  • Traffic control: Manage huge spikes when tickets go on sale to prevent system overload

Critical Constraints

  • No double-booking: The same seat cannot be sold to multiple buyers under any circumstances, even during failures or race conditions
  • Performance targets: Viewing availability should respond in under 200ms (p99); creating a reservation under 500ms
  • Scale: Handle 2 million simultaneous users competing for up to 80,000 seats
  • Load patterns: Expect 100,000 reads/sec for seat availability and 30,000 attempts/sec to reserve seats

Expected Coverage

Design the architecture addressing:

  1. Component layout: How traffic flows from users through various services to storage
  2. Inventory management: Data model for seats and the state transitions between available, reserved, and sold
  3. Concurrency control: Mechanisms preventing race conditions when multiple users target the same seat
  4. Reservation expiry: Safely reclaiming seats when payment doesn't complete in time, including edge cases where payment arrives just as time expires
  5. Demand management: Approaches to prevent overwhelming backend systems and detect automated bots
  6. Payment reliability: Ensuring exactly-once payment semantics despite retries and asynchronous callbacks

Provide concrete design choices with justification for your decisions.

Hints

Hint 1

Consider what can be cached versus what requires strong consistency - viewing availability and securing a seat have different requirements

Hint 2

Use optimistic concurrency control with version numbers to handle the race between reservation expiry and late payment completion

Hint 3

A queueing layer that admits users gradually protects downstream services and provides fairness, but needs to issue verifiable admission credentials