Design a High-Concurrency Concert Seat Reservation Platform
System DesignModel answerLast updated
Design a ticket booking system that handles millions of simultaneous users competing for limited inventory while preventing double-bookings and race conditions.
Problem Statement
You need to design an online seat reservation platform for live events like concerts and sports games. The system faces extreme load during ticket releases when demand vastly exceeds supply.
What the System Must Do
Core Features:
- Display real-time seat availability for specific events
- Allow users to temporarily reserve selected seats
- Complete payment processing and finalize bookings
- Automatically release unpaid reservations after a timeout window (10 minutes)
Critical Requirements:
Correctness: The system must never allow two customers to purchase the same seat. This is non-negotiable.
Responsiveness: Users should experience reasonable response times even when traffic surges by 100x during popular releases.
Performance: Read operations (browsing seats) happen much more frequently than writes (actual purchases).
Scale Parameters
- Peak concurrent users: 1,000,000 during a major release
- Typical event capacity: 50,000 seats
- Read-to-write ratio: approximately 100:1
- Hold duration: 10 minutes before automatic release
What You Need to Provide
- API Design: Define the key endpoints users and internal services will call
- Data Architecture: Choose appropriate storage technologies and schema design
- Consistency Strategy: Explain how you prevent race conditions and ensure exactly-once semantics
- Traffic Management: Describe your approach to handling extreme load spikes without system collapse
- Trade-offs: Discuss the choices you made and alternatives you considered
Think about both the happy path and failure scenarios. How does your design behave when the payment provider is slow? What happens if a user's session dies mid-checkout?
Hints
Hint 1
The core challenge is managing contention, not storage capacity—thousands of users competing for the same seats
Hint 2
Consider separating the read path (viewing availability) from the write path (making reservations) with different scaling strategies
Hint 3
Temporary holds create a state machine problem: available → held → purchased, with time-based transitions
Hint 4
A waiting room or admission control layer can transform an overwhelming spike into a manageable stream
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
High-Concurrency Seat Reservation Platform: Model Answer
Understanding the Problem Space
This design centers on extreme contention rather than data volume. With 50,000 seats and 1,000,000 competing users, the challenge is coordinating access to scarce resources, not storing large datasets.
Quick calculations:
- Read load: 1M users refreshing every 5 seconds = ~200,000 requests/second
- Write attempts: If 20% try to reserve in the first minute = ~3,300 attempts/second
- Actual inventory: Only 50,000 successful reservations possible
- State size: 50,000 seats × minimal metadata = ~100KB for a full seat map
The imbalance between demand and supply means most work is rejecting requests gracefully.
API Design
GET /events/{eventId}/seats
Returns: seat layout, availability by section
POST /reservations
Body: {eventId, seatIds: [], userId}
Returns: {reservationId, expiresAt} or 409 Conflict
DELETE /reservations/{reservationId}
Returns: 204 (manual release)
POST /purchases
Headers: Idempotency-Key
Body: {reservationId, paymentToken}
Returns: {confirmationId, status}
GET /purchases/{confirmationId}
Returns: {status, seats, totalAmount}
Key decisions:
- Idempotency-Key header prevents duplicate charges on retry
- Server-controlled expiration time prevents client clock skew issues
- Separate reservation and purchase steps allow payment processing time
Data Model
Primary Storage: Relational Database (PostgreSQL)
events
event_id (PK), venue_id, event_time, sale_start_time
seats
event_id, seat_id (composite PK)
section, row, number, price_cents
state: {available, reserved, sold}
reservation_id (nullable)
reserved_until (nullable)
row_version
reservations
reservation_id (PK), event_id, user_id
created_at, expires_at
state: {active, expired, completed, cancelled}
purchases
purchase_id (PK), reservation_id (unique)
user_id, total_amount, idempotency_key (unique)
payment_provider_id, state: {pending, confirmed, failed}
Why relational over NoSQL?
- Dataset is small and fits on a single powerful database instance
- ACID transactions provide exactly-once semantics for multi-seat reservations
- Row-level locking prevents race conditions naturally
- We don't need horizontal write scaling (total writes are bounded by inventory)
Caching Layer: Redis
- Cached seat maps keyed by event_id
- Pre-check bloom filters for "definitely taken" seats
- Rate limiting counters per user
- Not the source of truth—inconsistency here is acceptable
Preventing Double-Bookings
The reservation operation uses optimistic concurrency control:
BEGIN TRANSACTION;
-- Attempt atomic state transition
UPDATE seats
SET state = 'reserved',
reservation_id = :new_reservation_id,
reserved_until = NOW() + INTERVAL '10 minutes',
row_version = row_version + 1
WHERE event_id = :event_id
AND seat_id = ANY(:requested_seats)
AND (state = 'available'
OR (state = 'reserved' AND reserved_until < NOW()))
RETURNING seat_id;
-- Verify we got all requested seats
IF row_count != array_length(:requested_seats) THEN
ROLLBACK;
RETURN 409 Conflict;
END IF;
INSERT INTO reservations (...);
COMMIT;
Why this works:
- The UPDATE acquires row locks, serializing concurrent attempts
- The WHERE clause rechecks availability under the lock
- Expired reservations are treated as available (lazy cleanup)
- Either all seats are reserved or none are (atomicity)
- The row_version prevents lost updates if using application-level retries
Expiration handling:
- A background job periodically scans for
reserved_until < NOW()and transitions to available - Correctness doesn't depend on this job's timeliness—the reservation logic itself treats expired holds as available
- The job primarily updates caches and metrics
Payment Processing
Two-phase approach:
-
Authorization phase: When purchase is initiated, move seats from
reservedtopayment_pendingstate, which cannot be expired. Call payment provider to authorize the charge. -
Capture phase: Once authorization succeeds, atomically mark seats as
soldand capture the payment.
-- Transition to payment_pending (prevents expiration during payment)
UPDATE seats
SET state = 'payment_pending'
WHERE reservation_id = :res_id
AND state = 'reserved'
AND reserved_until > NOW();
-- After payment authorization succeeds
UPDATE seats
SET state = 'sold'
WHERE reservation_id = :res_id
AND state = 'payment_pending';
INSERT INTO purchases (...);
Handling async payment:
- If authorization takes >2 seconds, return "pending" status immediately
- Payment provider webhook notifies when complete
- Client polls status endpoint
- Reconciliation job resolves stuck transactions after timeout
Idempotency:
- Idempotency-Key in header maps to unique constraint in purchases table
- Retry of same key returns existing result, never creates duplicate charge
Managing Traffic Surges
Virtual Waiting Room:
Before sale time, users enter a queue. At sale start:
- Queue positions are assigned (randomized among early arrivals)
- System admits users at controlled rate (e.g., 5,000/minute)
- Admitted users receive short-lived signed token (JWT)
- API gateway rejects reservation attempts without valid token
This transforms 1M concurrent users into a manageable stream.
Read Path Optimization:
User → CDN (static assets)
→ API Gateway
→ Redis Cache (seat maps, refreshed every 1-2 seconds)
→ Database (only cache misses)
- Seat availability is cached and can be slightly stale
- Section-level summaries returned before detailed seat maps
- Staleness is safe because write path revalidates
Write Path Protection:
- Per-user rate limits (e.g., 3 reservation attempts per minute)
- Database connection pool sized to sustainable load
- Circuit breaker on payment provider calls
- Optimistic concurrency naturally rejects conflicting writes
Graceful Degradation:
- When database saturates, slow admission rate further
- Offer "best available seat" option to reduce hotspot contention
- Show queue position and estimated wait time
- Fail fast with meaningful errors rather than timeout
Architecture Diagram
┌─────────┐
│ Clients ├───┐
└─────────┘ │
├──→ [CDN/Edge]
┌─────────┐ │
│Monitoring│←──┤
└─────────┘ │
├──→ [Admission Service]
│ (Redis queue, token generation)
│
├──→ [API Gateway]
│ (auth, rate limit, routing)
│
├──→ [Read Service]
│ └──→ Redis Cache ──→ PostgreSQL
│
├──→ [Reservation Service]
│ └──→ PostgreSQL (primary)
│
└──→ [Payment Service]
├──→ Payment Provider
└──→ Event Queue (Kafka)
└──→ [Email, Analytics, Tickets]
[Cleanup Job] ──→ PostgreSQL (expire old reservations)
Trade-offs and Alternatives
Database Choice:
- Chose: PostgreSQL for ACID guarantees and small dataset
- Alternative: DynamoDB with conditional writes could work but adds complexity for multi-seat atomicity
- Trade-off: Single database is a bottleneck, but load is manageable with admission control
Waiting Room:
- Chose: Queue-based admission for fairness and load control
- Alternative: Pure rate limiting lets some users through immediately
- Trade-off: Added latency for all users, but system stays healthy
Cache Staleness:
- Chose: 1-2 second stale reads acceptable
- Alternative: Real-time seat map requires database for every view
- Trade-off: Users might attempt to reserve just-taken seats (rejected gracefully)
Reservation Timeout:
- Chose: 10-minute hold window
- Alternative: Shorter window returns inventory faster but rushes users
- Trade-off: Balances user experience with inventory velocity
Payment Flow:
- Chose: Synchronous with async fallback
- Alternative: Fully async gives faster perceived response but requires polling
- Trade-off: Best of both—fast when possible, resilient when slow
Common Mistakes to Avoid
- Using distributed locks without fencing tokens (can lead to double-booking after lease expiry)
- Making NoSQL the source of truth without understanding the consistency implications
- No admission control, leading to database overload and total failure
- Forgetting idempotency for payment operations
- No reconciliation strategy for stuck payment states
- Optimizing for scale that doesn't exist (inventory limits writes naturally)
The key insight is that this is a coordination problem under extreme contention, not a big data problem. The solution prioritizes correctness and controlled admission over raw throughput.