How Ticketmaster sells 20,000 seats to 500,000 fans without ever double-selling one

When a Taylor Swift sale opens, half a million people rush twenty thousand seats in the same instant, and exactly one buyer has to win each seat. No double-selling, no matter the load. That single constraint drives the entire design. The key insight most people miss: this is not a storage problem, it is a contention problem. The data is tiny. The challenge is hundreds of thousands of requests fighting over the same few thousand rows. So instead of asserting an architecture, we evolve one. We start with the most obvious design, a database row lock per seat, and watch it melt. Then we add exactly the piece that fixes each wall, so by the end every box has earned its place. What we cover: . Why a Postgres row lock per seat collapses under flash-sale load . Redis SETNX as the seat lock, and why a single-threaded server makes the race condition impossible . The two-phase hold-then-pay flow, and why locking through payment kills throughput . Atomic multi-seat locking with a Lua script . The stampede: why even Redis falls over at a million lock attempts a second . The virtual waiting room, the real fix, and why it beats auto-scaling . Why the queue position is random, and how that quietly kills ticket bots . Two layers: Redis for speed, Postgres for the guarantee that no seat is ever sold twice . Sharding by show id, the live seat map over Redis Pub/Sub, and the subtle hold-expiry race that can hand one seat to two people By the end you will understand not just what the architecture is, but why each part exists. If watching it come together from scratch helped it finally click, like and subscribe. The next build goes from naive all the way to production, one wall at a time. #systemdesign #ticketmaster #softwareengineering #codinginterview #redis #distributedsystems #backenddeveloper