System Design Problems interview question · Most asked

Design a ticket booking system (like Ticketmaster).

Summary

Hold seats with short-lived reservations (atomic seat-state transitions or Redis locks with TTL), complete payment within the hold window, and protect hot on-sales with a virtual waiting room that admits users at a controlled rate.

Requirements

  • Browse events and seat maps
  • Reserve specific seats; no double booking
  • Payment within a hold window (e.g., 10 min)
  • Huge spikes for popular events

API

GET  /api/events/{id}/seats            → seat map with availability
POST /api/events/{id}/holds  {"seat_ids": ["A1","A2"]} → {hold_id, expires_at}
POST /api/holds/{id}/purchase  Idempotency-Key: ...

Data Model

seats(event_id, seat_id, status /* available|held|sold */, hold_id, hold_expires_at, version,
      PRIMARY KEY (event_id, seat_id))
holds(id, user_id, event_id, expires_at, status)
orders(id, hold_id UNIQUE, user_id, total_minor, status)

Architecture

A waiting room service issues signed admission tokens at a controlled rate. Admitted users load cached seat maps (refreshed frequently) and request holds; the booking service atomically transitions seats from available to held with a conditional update (WHERE status='available') for all requested seats in one transaction. Payment completes the purchase; a sweeper or TTL releases expired holds.

Deep Dives

  • Double booking: conditional updates or optimistic locking per seat
  • Waiting room: queue position, fairness, bot protection
  • Seat map reads: cached and pushed via SSE; holds are the source of truth
  • General admission: decrement a counter instead of seats

Scaling

  • Partition by event
  • Cache event and seat-map reads heavily
  • Throttle writes via admission control

Comparison / Tradeoffs

Decision Option chosen Alternative Why
Hold mechanism DB conditional updates Distributed locks only Durable, consistent with the order
Spike handling Waiting room Autoscale only DB write capacity is the real limit

Explanation

What interviewers look for

A structured approach: clarify requirements and scale, sketch the API and data model, draw the high-level architecture, then go deep on the hardest component and discuss trade-offs, bottlenecks and failure modes.

Follow-up questions

  • How do you stop bots from buying all tickets?
  • How do you handle payment failures after the hold expires?

More most-asked System Design Problems questions

← All System Design Problems questions