Design a High-Concurrency Ticketing/Flash-Sale System (Limited Seats)
Context
You are designing the backend for a limited-seat flash sale (e.g., concert tickets). Millions of users may attempt to purchase simultaneously. The system must maintain strict correctness (no oversell), fairness, and resilience under extreme load, while supporting short reservations and payments.
Requirements
-
Scale and Correctness
-
Handle millions of concurrent purchase attempts.
-
No oversell; strict inventory correctness at seat or SKU level.
-
Real-time availability exposure.
-
Fairness and Backpressure
-
Provide fairness (FIFO queue or lottery).
-
Queueing with backpressure and rate limiting.
-
Purchase Flow
-
Short-term reservations with payment timeouts.
-
Idempotent order creation and safe retries.
-
Reliability and Performance
-
Anti-bot protections.
-
Shard hot items.
-
Describe read/write paths, caches/DBs, message queues.
-
Consistency model and reconciliation.
-
Failure handling.
-
Capacity planning and load testing.
Deliverables
Describe the following:
-
APIs (endpoints, request/response sketches).
-
Data model (core entities and keys).
-
Read and write paths.
-
Cache/DB choices and where to use them.
-
Message queues and their topics/uses.
-
Consistency model, reconciliation strategy.
-
Failure handling and fallbacks.
-
Capacity planning assumptions and calculations.
-
Load testing methodology and SLOs.