43. Design Flash-Sale Ticket Booking (Ticketmaster / IRCTC Tatkal)
1
The interview prompt2
43.1 What do you ask first?3
43.2 How big is this, really?4
43.3 What are the doors?5
43.4 What do we store?6
43.5 What does the whole system look like?7
43.6 How does the waiting room work?8
43.7 How does seat locking work?9
43.8 How do you rate-limit bots?10
43.9 How do you keep it fair?11
43.10 What would you say in the last five minutes?12
Score yourself13
Variations to practise14
Sources15
Code lab43. Design Flash-Sale Ticket Booking (Ticketmaster / IRCTC Tatkal)
Score yourself
3 min read+10 XP
Score yourself
Give yourself 0, 1 or 2 points per row.
| Area | 0 points | 1 point | 2 points |
|---|---|---|---|
| Requirements | Started drawing | Book a seat | Burst, oversupply of buyers, no double-sell, fairness and bots agreed |
| Estimates | None | Numbers, not used later | People per seat, admit rate and refresh storm drove the waiting room |
| API and data | Skipped | Book endpoint only | Join/status/admission token, holds with expiry, seats by section |
| High-level design | Scale the booking API | Queue without details | Static countdown, waiting room, admission, holds, payment, sold-out walked |
| Deep dive | Hand-waved | One topic | Waiting room mechanics, seat holds, bot defences or fairness with numbers |
| Trade-offs | None named | Named when asked | Raised unprompted (FIFO vs randomised, hold length, admit rate vs speed) |
| Communication | Long silences | Mostly clear | Thought out loud, checked in, managed time |
12 to 14: strong hire signal. 8 to 11: solid, polish the weak rows. Under 8: redo the round in a week, timer on.
The bar: fresher vs SDE-2
| Fresher | SDE-2 | |
|---|---|---|
| Load | Autoscale servers | Waiting room admitting at the rate seats can be sold; static pre-open page |
| Seats | Lock a row | Conditional holds by section, expiry, best-available assignment |
| Bots | CAPTCHA | Verified accounts, limits, edge detection, signed admission tokens |
| Fairness | First-come | Randomised opening window, one spot per account, lotteries |
| Honesty | Errors under load | Accurate position, ETA and instant "sold out" |
Common mistakes
- Letting everyone hit the booking API at 10:00 and hoping autoscaling copes.
- Holding seats without expiry, or for too long.
- First-come by milliseconds, which hands the sale to bots.
- No admission token, so bots skip the queue by calling booking APIs directly.
- Keeping people waiting after seats are gone.
Quick check
Five questions on this chapter. Pick an answer, then check it.
quiz