Skip to main content
← PROBLEMS / SYSTEM-DESIGN
An end-to-end domain learning journey

Design Ticketmaster &
Flash-Sale Reservations.

Design a high-concurrency event ticketing platform like Ticketmaster or BookMyShow. The system must handle sudden 1,000,000-user traffic surges attempting to purchase 50,000 seats at the exact same second. It must guarantee strict transactional consistency (zero double-booking), handle user cart abandonment, and prevent database deadlocks.
Start the journey5 stages
Loading diagram…
Design Ticketmaster & Flash-Sale Reservations architecture sketch diagram
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

Design a high-concurrency event ticketing platform like Ticketmaster or BookMyShow. The system must handle sudden 1,000,000-user traffic surges attempting to purchase 50,000 seats at the exact same second. It must guarantee strict transactional consistency (zero double-booking), handle user cart abandonment, and prevent database deadlocks.

From patterns to decisions.

Design a high-concurrency event ticketing platform like Ticketmaster or BookMyShow. The system must handle sudden 1,000,000-user traffic surges attempting to purchase 50,000 seats at the exact same second. It must guarantee strict transactional consistency (zero double-booking), handle user cart abandonment, and prevent database deadlocks.

01
SYSTEM-DESIGN · STAGE 01L4 · FUNDAMENTALS

Flash-sale checkout engine handling 50,000.

Flash-sale checkout engine handling 50,000 concurrent purchase transactions for 500 limited sneaker SKUs. Failure cascade dynamic: Burst → Pool Saturated → Queue Bloat (10k) → STW GC → 💥 504 Timeouts.

ChoiceWhat it buysWhat it costs
Operational InvariantNever acquire relational row locks (SELECT FOR UPDATE) on shared hot counters during peak traffic surges; use in-memory atomic staging.
Workload BaselineFlash-sale checkout engine handling 50,000 concurrent purchase transactions for 500 limited sneaker SKUs.
02
SYSTEM-DESIGN · STAGE 02L5 · APPLIED DESIGN

Implementation & Guardrails (2).

Ticketmaster burst booking architecture resolves thundering herds via a distributed Virtual Waiting Room (token-bucket rate limiting ingress to 2,000 req/sec), pessimistic row-level locking (SELECT FOR UPDATE) to prevent double-booking, and delayed message queues to release abandoned reservations after 5 minutes.

ChoiceWhat it buysWhat it costs
Pessimistic Locking vs In-Memory Redis StagingPessimistic locking in SQL guarantees strict ACID consistency but suffers from database connection limits at extreme scale. Redis Lua staging handles 100k QPS in RAM but requires eventual synchronization to PostgreSQL via Kafka Outbox.
Virtual Waiting Room vs Direct BookingA waiting room adds learner queue friction but guarantees 100% server uptime and fair FIFO processing.

1. Virtual Waiting Room

Incoming users are queued in a distributed token bucket system. A rate limiter admits a controlled stream (e.g. 2,000 users/sec) to the seat selection service.

2. Live Map Browsing

Read seat availability from an edge Redis cache; WebSocket connections push real-time seat lock updates to all active viewing clients.

3. Pessimistic Row Lock

When user taps "Reserve", execute a transaction in PostgreSQL using row-level locking (SELECT FOR UPDATE) to transition seat status from AVAILABLE to LOCKED with a 5-minute lease.

4. Delayed Message Queue

Schedule a message in AWS SQS with a 5-minute delay. If payment confirmation has not arrived when the delayed message is consumed, revert seat status to AVAILABLE.

Cart Abandonment Inventory Lockup

Users lock thousands of seats and close their browsers. Without an automated background cleanup (delay queue / cron), inventory remains locked while genuine buyers are turned away.

Deadlocks on Multi-Seat Reservations

If User 1 locks Seat A then Seat B, while User 2 locks Seat B then Seat A, the database deadlocks. Mitigation: Enforce strict deterministic sorting of seat IDs (e.g. ORDER BY seat_id ASC) prior to acquiring row locks.

-- PostgreSQL Atomic Reservation with Pessimistic Row Locking
BEGIN TRANSACTION;

SELECT seat_id, status 
FROM seats 
WHERE event_id = 101 AND seat_number = 'A-42' AND status = 'AVAILABLE'
FOR UPDATE; -- Acquires exclusive row-level lock

UPDATE seats 
SET status = 'RESERVED', 
    reserved_by = 9942, 
    reservation_expires_at = NOW() + INTERVAL '5 minutes'
WHERE seat_id = 42;

COMMIT;
03
SYSTEM-DESIGN · STAGE 03L6 · SCALE & TRADE-OFFS

Trade-Off Analysis.

Architectural comparison of naive unconstrained allocations versus production-hardened mechanical sympathy.

ChoiceWhat it buysWhat it costs
Ingress AdmissionNaive unconstrained buffering causes queue bloat and GC exhaustion. Mitigation: Bounded ingress gate with fast non-blocking shedding.
Resource StrategyStatic capacity allocations collapse under brownouts. Mitigation: Dynamic adaptive limits scaling to real-time physical bounds.
Outage ImpactCascading lock convoys and memory saturation. Mitigation: Isolated failure domains keep P99 latency flat and protected.

Alternative 1

Naive Approach: Executing 'SELECT stock FROM inventory WHERE item_id = 101 FOR UPDATE'. 50,000 database transactions serialize behind a single InnoDB/PostgreSQL row l

Alternative 2

Production-Hardened Pattern: Offload real-time inventory reservation to an in-memory single-threaded atomic engine (Redis Lua script via DECRBY), issuing an ephemeral 15- minute l

04
SYSTEM-DESIGN · STAGE 04L6 · SCALE & TRADE-OFFS

Failure physics analysis.

Failure physics analysis: Burst → Pool Saturated → Queue Bloat (10k) → STW GC → 💥 504 Timeouts.

Cascading Failure

Executing 'SELECT stock FROM inventory WHERE item_id = 101 FOR UPDATE'. 50,000 database transactions serialize behind a single InnoDB/PostgreSQL row lock. HikariCP connection pool (100 connections) exhausts in 12ms; database CPU hits 100% on deadlock detection, crashing the API.

Breakdown Chain

Burst → Pool Saturated → Queue Bloat (10k) → STW GC → 💥 504 Timeouts

Shedding Failure

Without fast rejection at the boundary, queued dead work triggers multi-second GC pauses, CPU thrashing, and cascading 504 Gateway Timeouts.

05
SYSTEM-DESIGN · STAGE 05L7 · STAFF / PRINCIPAL

Senior Staff SRE Interview challenge.

Senior Staff SRE Interview challenge and architectural invariant verification.

ChoiceWhat it buysWhat it costs
Architectural Invariant"Never acquire relational row locks (SELECT FOR UPDATE) on shared hot counters during peak traffic surges; use in-memory atomic staging."
Physical Resource BoundaryDynamic admission control ensures worker threads never buffer dead requests during downstream brownouts.

Step 1

1. Track real-time latency gradients and inflight concurrency.

Step 2

2. Reject excess traffic at the ingress boundary within <0.1ms.

Step 3

3. Monitor P99 latency and verify autonomous recovery when downstream pressure subsides.

Theory & Tips and Tricks

Practical heuristics & interview traps

  • 01Interview anchor: Isolate ingress routing, decouple transactional state from background operations, and enforce explicit timeout and retry budgets across all service boundaries.
  • 02Trade-off tip: Ingress Admission: Naive unconstrained buffering causes queue bloat and GC exhaustion. Mitigation: Bounded ingress gate with fast non-blocking shedding.
  • 03Trade-off tip: Resource Strategy: Static capacity allocations collapse under brownouts. Mitigation: Dynamic adaptive limits scaling to real-time physical bounds.
  • 04Watch out for: Cascading Failure: Executing 'SELECT stock FROM inventory WHERE item_id = 101 FOR UPDATE'. 50,000 database transactions serialize behind a single InnoDB/PostgreSQL row lock. HikariCP connection pool (100 connections) exhausts in 12ms; database CPU hits 100% on deadlock detection, crashing the API.
  • 05Watch out for: Breakdown Chain: Burst → Pool Saturated → Queue Bloat (10k) → STW GC → 💥 504 Timeouts
Behavioral Progression · Design Ticketmaster Flash Sale System

Design Ticketmaster Flash Sale System — Normal → Load / Fault → Recovery

Send Request
1. Normal Request Ingress
Traffic: 1x baseline · Latency (p99): 4 ms
Process State
2. Core Execution & State Lookup
Traffic: 1x baseline · Latency (p99): 9 ms
Inject 10x Spike
3. Scale Spike / Failure Injection
Traffic: 10x burst · Latency (p99): 185 ms

Isolate ingress routing, decouple transactional state from background operations, and enforce explicit timeout and retry budgets across all service boundaries.

Synthesis / One connected design

Putting Design Ticketmaster & Flash-Sale Reservations Together

Isolate ingress routing, decouple transactional state from background operations, and enforce explicit timeout and retry budgets across all service boundaries.

A candidate architecture, not a universal answer

Putting Design Ticketmaster & Flash-Sale Reservations Together

Step 1
Step 2
Step 3
Step 4
  1. 1. Virtual Waiting Room: Incoming users are queued in a distributed token bucket system. A rate limiter admits a controlled stream (e.g. 2,000 users/sec) to the seat selection service.
  2. 2. Live Map Browsing: Read seat availability from an edge Redis cache; WebSocket connections push real-time seat lock updates to all active viewing clients.
  3. 3. Pessimistic Row Lock: When user taps "Reserve", execute a transaction in PostgreSQL using row-level locking (SELECT FOR UPDATE) to transition seat status from AVAILABLE to LOCKED with a 5-minute lease.
  4. 4. Delayed Message Queue: Schedule a message in AWS SQS with a 5-minute delay. If payment confirmation has not arrived when the delayed message is consumed, revert seat status to AVAILABLE.
Failure physics analysis: Burst → Pool Saturated → Queue Bloat (10k) → STW GC → 💥 504 Timeouts.
Interview Readiness Check

Failure physics analysis: Burst → Pool Saturated → Queue Bloat (10k) → STW GC → 💥 504 Timeouts.

Walk through bottlenecks, back-of-the-envelope math, and failure recovery.

Practice / Explain the consequences

Make the trade-off yourself.

Practice Check

Test your understanding

Question 1 of 3

Why do high-throughput write-heavy storage engines (like RocksDB and Cassandra) use LSM-Trees instead of traditional B+ Trees?

Key takeaway

Design Ticketmaster & Flash-Sale Reservations

Isolate ingress routing, decouple transactional state from background operations, and enforce explicit timeout and retry budgets across all service boundaries.