Selling tickets without selling a seat twice

A ticketing site crashes and double-books seats when a popular show goes on sale. Design for the spike.

To design ticket booking, make seat reservation atomic with a conditional update, model seats as available, held with an expiry, or sold, and release expired holds. Protect the system with a virtual waiting room, serve seat maps from a cache, and make payment idempotent.

The system today: A ticketing site has a web server and one database. A seats table has a status column (available, sold). When a hit show goes on sale the site slows to a crawl, and twice last month two customers were sold the same seat.

What has to change: Design booking for a sale where 500,000 people arrive within a minute for 20,000 seats. Seats must never be sold twice, people should hold a seat while they pay for a few minutes, the site must stay up under the spike, and the experience should be fair.

Questions to ask first

Where the interviewer digs in

What a strong answer covers

Common mistakes