Flash-Sale Ticketing System Design
Sell a limited batch of concert tickets when everyone shows up at once.
About this problem
Design the ticketing system for a flash sale, like a popular concert going on sale. A fixed number of seats is released at a set time, and a huge crowd arrives at once to view the event and try to buy.
Buyers check out and reserve seats, and the same seat must never be sold twice, however many people try for it at the same moment.
Traffic spikes from a trickle to about 6,000 requests per second and back, over and over. Most requests view the event page. About 30% are checkouts, and every checkout is a purchase that has to be exactly right.
Requirements
- Browse the event page and seat map.
- Check out and reserve seats.
- Never sell the same seat twice.
Scale targets
- Traffic spikes from a trickle to peak and back, over and over.
- Checkout is almost all writes, and each one is a transaction that must never sell a seat twice.
Traffic
Periodic, 50 to 6,000 TPS. The simulator sets this traffic up for you when you start the problem.
CAP trade-off
A seat can never be sold twice. When the system can't be sure a seat is free, a checkout should fail rather than risk a double sale.
Practice it
Build it on the canvas, run the traffic, and get scored.
Related problems
- Video Streaming (YouTube) System Design
Serve video to a global audience while creators keep uploading.
- URL Shortener System Design
Turn long URLs into short codes and redirect visitors fast.
- Pastebin System Design
Let people store text snippets and share them by link.