Design a Concert & Event Ticket Sales Platform
System DesignModel answerLast updated
Design a seat reservation system for high-demand events, covering inventory consistency, surge traffic, payment edge cases, and failure recovery.
Design a Concert & Event Ticket Sales Platform
You are building the backend for a ticket sales platform that handles high-demand events — think a stadium concert where tens of thousands of seats go on sale simultaneously.
Your system needs to let users browse upcoming events, check what seats or sections are still available, temporarily lock a seat while they check out, process payment, and receive a confirmed booking. The golden rule: the same seat must never be confirmed to two separate buyers.
Walk through your design end to end. Cover the data model, key APIs, how you handle the flood of traffic the moment sales open, and how you recover gracefully from failures.
What to address
- The services or components you would build and how they interact
- How you model seat state and enforce that no two users can confirm the same seat
- How you handle temporary holds and what happens when they expire
- How you protect the inventory store when traffic spikes at sale-open
- How you handle payment provider timeouts where it is unclear whether a charge succeeded
- Where you apply caching, and what consistency guarantees each layer needs
- How you would detect and alert on problems in production
Constraints and rules
- A seat confirmed to one order must never be confirmed to a second order, under any failure mode
- Holds are time-limited: if the user does not complete checkout within a configured window, the seat is released back to available inventory
- Event catalog data and general availability counts can be slightly stale; the actual per-seat lock during checkout cannot
- Payment providers can time out mid-charge, leaving the outcome genuinely ambiguous
Good clarifying questions to open with
- Are seats individually assigned (row/seat number) or is this general admission where only a quantity matters?
- What fairness model is expected when sales open — first come first served, a virtual waiting room, or a lottery?
- Can a single hold span a set of adjacent seats, and does that constraint need to be enforced atomically?
- What is the target scale — peak RPS at sale-open, geography, and expected event catalog size?
Hints
Hint 1
Start by separating read-heavy concerns (browsing, availability counts) from the write-critical path (holds and confirmations). These have very different consistency and scaling requirements, so mixing them in one service creates unnecessary bottlenecks.
Hint 2
Think about seat state as a small finite state machine: available → held → confirmed (or held → available on expiry). The key question is how you make that transition atomic across concurrent requests — a database row lock, an optimistic version check, or a Redis SET NX are all candidates worth comparing.
Hint 3
Payment timeouts are the hardest failure case. Sketch out what your system does in the window between 'charge sent' and 'no response received': does it hold the seat indefinitely, release it, or park the order in an ambiguous state to be reconciled asynchronously?
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Strong Answer
Clarifying questions first
Before drawing anything, nail down scope. Individual seat selection is more complex than general admission (you need per-row/seat state rather than a counter). A virtual waiting room changes the traffic shape dramatically. These answers determine your data model and your surge strategy, so establish them up front.
Service decomposition
Break the system into four focused areas:
Catalog service — event metadata, venue layouts, pricing tiers. Reads dominate. A CDN plus read replicas handle scale; eventual consistency is fine.
Inventory service — the source of truth for seat state. Every hold and confirmation goes through here. This is the consistency-critical component.
Order service — orchestrates checkout: creates a pending order, calls the payment provider, then instructs the inventory service to confirm or release.
Notification service — sends confirmation emails and booking PDFs asynchronously after an order is confirmed. Decoupled via a message queue so order creation is never blocked by email delivery.
Seat state machine
Model each seat as a row in an inventory table with a status column: AVAILABLE, HELD, or CONFIRMED. Add held_by, hold_expires_at, and a version integer for optimistic locking.
The hold transition must be atomic. Using Postgres as an example:
UPDATE inventory
SET status = 'HELD',
held_by = :user_id,
hold_expires_at = NOW() + INTERVAL '10 minutes',
version = version + 1
WHERE seat_id = :seat_id
AND status = 'AVAILABLE'
AND version = :expected_version;
If the UPDATE touches zero rows, the seat was already taken — return a 409 immediately. No separate SELECT is needed; the conditional UPDATE is the lock. This avoids the classic lost-update race condition.
A background worker (or a Postgres pg_cron job) sweeps for rows where status = 'HELD' AND hold_expires_at < NOW() and resets them to AVAILABLE. Sweep every 30–60 seconds; expired holds are low urgency.
If you need sub-millisecond hold latency at very high concurrency, Redis SET seat:<id> <user_id> NX PX 600000 gives atomic compare-and-set with built-in TTL expiry. The trade-off is that Redis is harder to make durable than Postgres, so you would still write through to the database for confirmed orders.
Surge control at sale-open
When 50,000 users hit "buy" at the same second, your inventory store cannot absorb that directly. Two complementary approaches:
Virtual waiting room. Before sale-open, users enter a queue. At sale-open, the system drips them into the purchase flow at a controlled rate — say 500 users per second — using a token bucket. This converts a thundering herd into a steady stream. Users get a fair position in line (based on queue entry time, optionally with randomisation to discourage bots camping the exact open time).
Availability cache. Serve rough seat counts from a Redis cache or CDN-cached endpoint so browsing requests never touch the inventory database. Invalidate the cache on confirmed sales, not on holds. A user might see "50 seats left" when there are actually 40 (some are held), which is acceptable per the eventual consistency rule for catalog data.
Never expose the raw inventory database to unauthenticated browsing traffic.
Payment and idempotency
The order flow is:
- Create a pending order with a stable
idempotency_key(e.g.,user_id + cart_id + attempt_number) - Call the payment provider with that key
- On success: transition seat to
CONFIRMED, order toCOMPLETE - On explicit failure: release the hold, order to
FAILED - On timeout or network error: do not release the hold immediately
Step 5 is the critical case. When the provider times out, you do not know if the charge succeeded. Park the order in a PAYMENT_PENDING state and keep the hold alive. A reconciliation job polls the provider's status endpoint (or waits for its webhook) with exponential backoff. Once the outcome is confirmed, it either completes or cancels the order. Releasing the hold immediately risks confirming a charge and then selling the seat to someone else.
Idempotency keys mean that if the order service retries the charge, the provider returns the original result rather than double-charging.
Caching strategy
| Layer | What it caches | Consistency |
|---|---|---|
| CDN | Event pages, venue maps | Minutes stale, fine |
| Redis | Seat availability counts per section | Seconds stale, fine |
| Application | Nothing for seat-level state | Must always hit DB/Redis |
Never cache seat-level hold state in a layer you cannot atomically update. Cache invalidation on every hold would negate the performance benefit.
Observability
Key metrics to instrument:
- Hold attempt rate vs. success rate (high failure rate signals overselling pressure or a bug)
- Hold expiry rate (abnormally high suggests checkout flow friction)
- Payment reconciliation queue depth (growing queue signals provider issues)
- P99 latency on the hold and confirm endpoints
Alert on: duplicate confirmation attempts (should never succeed, but if the code tries it fires a critical alert), reconciliation queue depth growing unchecked, and seat state mismatch between the cache and the database.
Common mistakes to avoid
- Using a
SELECTfollowed by anUPDATEto check seat state — this is a race condition under concurrent load - Releasing a hold immediately on payment timeout instead of parking for reconciliation
- Sending the same database instance read and write traffic during a surge
- Forgetting that hold expiry is eventually consistent; a seat might appear available in the cache for a few seconds after the hold is created