Layer 3 · Go deeper · 12 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How big is the seat inventory the whole design protects?
How heavy is a 60,000-seat stadium map?
What does a stadium on-sale throw at you?
Admitting 200 fans a second, how fast does the stadium sell out?
Build-up · 5 steps
Build the high-level design
One functional requirement at a time, ending with a design that works on an ordinary day.
Step 1 of 5
Search and browse
Browsing is most of the traffic and almost all cacheable. The CDN answers popular pages for about a minute; misses reach a catalogue that reads Postgres and an Elasticsearch index fed from it.
6 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 6
Interviewer
“At 12:00:03, Asha in Pune and Ravi in Chennai both click seat C-K-14. How do you make sure exactly one gets it?”
Your move. Pick an approach:
Deep dive 2 of 6
Interviewer
“Two million fans arrive at noon for 60,000 seats, about 1M requests a second. How do you keep the sale standing and fair?”
Your move. Pick an approach:
Deep dive 3 of 6
Interviewer
“60,000 shoppers watch one stadium map while seats change hundreds of times a second. How do you keep their maps live?”
Your move. Pick an approach:
Deep dive 4 of 6
Interviewer
“Inventory is sharded by event. At noon one shard takes the on-sale’s 800 writes a second. What do you change?”
Your move. Pick an approach:
Deep dive 5 of 6
Interviewer
“Scalper bots are fast, numerous and patient. How do you stop them buying up the stadium?”
Your move. Pick an approach:
Deep dive 6 of 6
Interviewer
“A UPI request can sit on a phone for minutes, and webhooks arrive late or twice. How do you confirm exactly once?”
Your move. Pick an approach:
Build-up · 7 steps
Follow one fan through a hot on-sale
Everything a fan reads comes from a cache or an index. Everything that changes a seat is one conditional statement on the event’s shard. The crowd waits at the edge.
Step 1 of 7
Search and browse
“Coldplay Ahmedabad” comes from the CDN if anyone asked in the last minute. Otherwise the catalogue queries the search index that change data capture keeps in step with the Events DB.