A stadium tour goes on sale at 10am. Two million fans want sixty thousand seats, and each
fan does not want "a seat", they want G5 in the floor section, next to their friend in G4.
Every seat is its own tiny auction, and it closes in milliseconds.
Watch one fan get from the line to a ticket.
Line up. At 10am two million fans land on the waiting room. It gives each one a place in line and does nothing else.
The picture is two systems with very different promises. The top half, the seat map, may be
a little out of date, and it takes nearly all the reads. The bottom half, the hold, must be
exact for every single seat, and it takes very few writes. Most of this page is about keeping
those two promises separate.
If you have read IRCTC tatkal, here is the difference that
matters. There, seats in a class are interchangeable, so the whole fight is over one number
per train. Here the fan chooses seat G5, so every seat is its own row and its own race, and a
group of seats has to be won together. The same problem shows up when you book two seats next
to each other for a first day, first show at a cinema, or tickets for an IPL final.
The real Ticketmaster
This page builds the core of a ticketing site like Ticketmaster: choose seats from a map, hold
them while you pay, and survive an on-sale where demand is many times the supply. The numbers
are interview assumptions, not Ticketmaster's. Two real things worth knowing: Ticketmaster
puts popular on-sales behind a queue and runs Verified Fan registration to filter out bots
before the sale, and it said the Eras Tour presale in November 2022 drew 3.5 billion system
requests, four times its previous peak, which it blamed on bots and fans without invite codes.
Bot defence is a large real system that this page names but does not build.
A few words used all through this page:
A hold takes seats off sale for a few minutes while one fan pays. If they never pay,
the seats go back.
The seat map is the picture of a section with every seat coloured free, held or sold.
The waiting room gives each fan a place in line before they may shop, like the token
machine at a bank.
An on-sale is the moment a popular event's tickets go on sale, announced in advance.
Ask about the seats before you ask about the traffic. Whether a fan picks a specific seat or
just "two tickets in the upper tier" decides what the contended thing is, and everything else
follows from that.
You ask
They say
What it settles
Do fans pick specific seats, or just a section and a count?
Specific seats from a map, with a "best available" button as well.
Every seat is its own row and its own race. The contention is spread over sixty thousand rows instead of one counter, but a group of seats now has to be claimed all at once.
How big is the on-sale?
About two million fans for about sixty thousand seats, at a time announced weeks ahead.
Thirty or more fans per seat, so most fans leave without a ticket. Like tatkal, the front door is a rejection system and the booking path behind it is small.
How long can a fan sit on seats while paying?
A few minutes, with a countdown. Assume 8.
A hold with an expiry on every seat row, and a rule for when time runs out in the middle of a payment.
Can the seat map be out of date?
By a couple of seconds, yes. The hold must never be wrong.
Two promises. The map is a cache that can lie a little, and the hold is checked against the seat rows every time. A fan tapping a seat that just went is answered with a 409 and a fresh map.
How many tickets can one order have?
Up to 8, and the seats are usually next to each other.
All or nothing claims across several rows. A fan who wanted a pair and got one seat has been handed something useless that is now off sale.
What about bots and resellers?
A real problem. Assume registration filters most of them before the sale.
A per account limit on tickets and on active holds, enforced at the hold. Full bot detection is out of scope, but the design must not reward a script that holds seats it never pays for.
A small version first. A 60,000 seat stadium, four tickets per order, is 15,000 orders. If it
sells out in ten minutes, that is 1,500 checkouts a minute, which is 25 a second. That number
is small. The people trying to become one of those 25 a second are not. (The
back of the envelope chapter covers the method.)
Fans against checkouts
2000 thousand
60000
4
10
Orders in the whole venue60,000 / 4 = 15,000
Fans per order2,000,000 / 15,000 = 133 to 1
Checkouts per second to sell out15,000 / (10 x 60) = 25.0
Fans who leave without tickets1,985,000
25 checkouts a second
is all the booking path has to do
The booking path is tiny: 25 new checkouts a second would sell the venue out in 10 minutes. Everything big on this page exists to keep 2,000,000 people from touching it at once, while the few who are let in see a map that is close enough and a hold that is exact.
Read the first and third rows together. The writes that matter are a few dozen a second. The
waiting room and the seat map cache carry everything else, and the hold service never sees the
crowd at all.
2,000,000 fanswaiting roomhold service25 checkoutsa secondthe hold service never sees the crowd