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)
43.1 What do you ask first?
3 min read+10 XP
Step 1: Requirements (5 minutes)
| Letter | Candidate asks | Interviewer answers |
|---|---|---|
| Scope | "Numbered seats or general admission? Seat map selection or best available? Limits per person? Payment inside the flow?" | "Numbered seats, best available within a chosen section. Up to 4 per account. Payment within a few minutes." |
| Count | "How many seats, how many people?" | "50,000 seats. About 2 million people waiting at 10:00." |
| Access pattern | "When do they arrive?" | "Most in the minute before and after 10:00, refreshing constantly. Plus bots." |
| Latency | "What must users experience?" | "No crashes, an honest wait, and if they get a seat, enough time to pay." |
| Exactness | "Can we double-sell a seat? Is fairness a requirement?" | "Never double-sell. Fair to people, not to bots." |
Agreed requirements:
- Functional (verbs): people wait for the sale; get admitted in order; pick and hold seats; pay within a time limit; receive tickets; unpaid holds return to sale.
- Non-functional (adjectives): survives a 2-million-person burst without falling over, never double-sells, fair (bots don't win by speed), honest (clear queue position, clear "sold out"), protects downstream systems (seat inventory, payments).
Interviewer pushback:
- "Why not just scale the booking system to 2 million users?" → Because the bottleneck isn't servers, it's seats: 2 million people competing for 50,000 seats means most requests touch the same few hot rows. Letting everyone in at once just turns contention into failures. Admit people at the rate seats can actually be sold.
Memory code: "Ask how many seats, how many people, and who's a bot."