Ticketmaster / Event Booking
Selling a fixed set of seats to a stampede of buyers without double-booking — worked through the TOGAF ADM phases so the reserve-then-confirm flow in Phase D falls out of the requirements.
Ticketmaster / event booking, the ADM way, in 30 seconds
- Why TOGAF here: it forces business intent → requirements → data/app → technology in order, so the reserve-then-confirm flow in Phase D is a consequence of the no-double-booking rule, not a reflex.
- A (Vision): sell a fixed seat inventory fairly without ever double-selling a seat; principles — strongly consistent inventory, fair under spikes, correctness over availability.
- B (Business): three capabilities — browse events, reserve a seat, confirm on payment.
- C (Data/App): a seat-inventory store with per-seat state, an orders store, and a holds mechanism with expiry; a queue to flatten on-sale spikes.
- D (Technology): the real meat — a reserve-then-confirm flow where a seat is HELD with a TTL, confirmed atomically on payment, and auto-released if unpaid; a waiting-room queue and rate limiting to survive on-sale spikes; strong consistency on inventory.
- E–H: launch with a queue and small inventories; govern with correctness and fairness SLOs.
- The lesson: "never double-book, strong consistency on inventory" (Phase A) is exactly why Phase D is a locked, TTL'd hold confirmed by an atomic transaction — not an optimistic free-for-all.
Like a changing room with a limited number of stalls
Think of a store with exactly six changing-room stalls and a crowd waiting. When a stall frees up, one person — and only one — is let in and the door locks behind them. They get a few minutes to decide. If they buy, the item is theirs; if they dawdle too long, an attendant opens the door and the stall goes back to the next person in line. Nobody is ever handed a stall someone else is already standing in, and no stall sits locked forever behind someone who wandered off.
Event booking is that changing room at terrifying scale. The 'stalls' are seats — a fixed, tiny number. The 'crowd' is a million people hitting the site in the first minute. The two rules that run the changing room are the whole design: exactly one person per stall (never double-book a seat) and a time limit on the hold (so an abandoned seat returns to the pool). Everything in Phase D is machinery to enforce those two rules under a stampede.
What makes it hard — the problem before the solution
- Supply is fixed and tiny; demand is enormous. 60,000 seats, a million buyers in minute one — the system's main job is to reject most attempts safely while letting a controlled few succeed.
- Double-selling is unforgivable. Two buyers claiming seat 14C is a real-world failure you can't undo gracefully, so the seat claim must be truly atomic — not a hopeful read-then-write.
- A seat must be held while the buyer pays — but not forever. You can't finalize a sale before money clears, yet you can't lock a seat indefinitely behind someone who abandoned checkout.
- The spike itself is a threat. Even perfectly correct booking logic melts if a million simultaneous requests hit the correctness-critical core at once. You have to flatten the wave before it lands.
Why work event booking through TOGAF?
Booking looks like e-commerce until you notice the brutal constraint: there is exactly one seat 14C, tens of thousands of people want it the instant the sale opens, and selling it twice is unacceptable. That turns a CRUD app into a concurrency-correctness problem with a traffic spike on top. The ADM's discipline of order keeps those two forces untangled: Phase A commits to correctness over availability, Phase B separates the reserve step from the confirm step, so Phase D can build a locked, time-boxed hold — every piece defending a decision made earlier.
Phase A — Architecture Vision
Intent: agree what we're building, for whom, and the principles that will constrain every later choice.
- Vision: a service that sells a fixed inventory of seats for an event fairly and quickly, and never sells the same seat to two buyers.
- Stakeholders: buyers (want a fair shot and a seat that stays theirs while they pay); venues/artists (want every seat sold, no overselling); the business (wants to survive the on-sale stampede).
- Principles (the constraints that cascade): strongly consistent inventory (a seat is sold at most once); fair under spikes (orderly access when demand massively exceeds supply); correctness over availability (if forced to choose, reject rather than double-sell).
Phase B — Business Architecture
Intent: model the business capabilities and value streams before any technology talk.
- Value stream: buyer browses events → picks seats → reserves them → pays → receives confirmed tickets — or the hold expires and the seats return to the pool.
- Capability 1 — Browse events & availability: high read volume, tolerant of slight staleness in the count shown.
- Capability 2 — Reserve a seat: the correctness pinch point — a specific seat must be claimed by exactly one buyer, temporarily.
- Capability 3 — Confirm on payment: turn a temporary hold into a permanent sale atomically, or release it if payment never completes.
Impact: the critical insight is that reserve and confirm are two steps, not one. A buyer needs a seat locked while they enter payment, but the sale isn't final until money clears. That two-step shape, named here in Phase B, is precisely what Phase D implements as a TTL'd hold followed by an atomic confirm.
Phase C — Information Systems Architecture (Data & Application)
Intent: define the data and application architecture, and the gap from today (today = nothing; greenfield).
Data architecture
- Core entity: a
seat— eventId, seatId, section/row, price, and a state:available → held → sold, plusheldByandholdExpiresAt. - Order entity: an
order— orderId, buyerId, seatIds, status (pending/paid/cancelled), paymentRef; the durable record of a sale. - Access pattern: the hot, correctness-critical operation is a conditional state transition on a single seat — flip
available → heldonly if currently available. That's a transactional update, not a bulk query. - Conclusion: the seat inventory wants a store with real ACID transactions (see ACID transactions) so the state transition is atomic; a relational store fits this naturally (see SQL vs NoSQL). The access pattern chose the data model.
-- Each seat is a tiny state machine: available -> held -> sold.
CREATE TABLE seat (
seat_id BIGINT PRIMARY KEY,
event_id BIGINT NOT NULL, -- partition/shard key
section TEXT, row TEXT, price_cents INT,
state TEXT NOT NULL, -- 'available' | 'held' | 'sold'
held_by BIGINT, -- buyer holding it (NULL if free)
hold_expires_at TIMESTAMP -- when a 'held' seat auto-releases
);
CREATE INDEX idx_seat_event_state ON seat (event_id, state);
-- Orders are the durable record of a finalized sale.
CREATE TABLE "order" (
order_id BIGINT PRIMARY KEY, buyer_id BIGINT NOT NULL,
seat_ids BIGINT[] NOT NULL, status TEXT NOT NULL, -- pending|paid|cancelled
payment_ref TEXT, created_at TIMESTAMP NOT NULL
);Application architecture
- A browse/read tier serving event and availability pages, kept separate (and cache-friendly) from the booking path.
- A booking service that owns the reserve-then-confirm flow and is the only writer to seat state, so the invariant lives in one place.
- A waiting-room / queue in front of the on-sale so a spike is admitted at a controlled rate instead of all at once.
Phase D — Technology Architecture (the core)
Intent: choose the concrete technologies and the physical/deployment design that realize Phase C — and justify each one against the principles and requirements. This is where a technical interviewer spends most of the time, so we'll cover every step.
D1 — Estimate the load (sizing drives technology)
# A hot on-sale: 60,000 seats, 1,000,000 buyers arrive in the first minute
seats = 60_000
arrivals_min = 1_000_000
arrival_per_sec = arrivals_min / 60 # ~16,700 attempts/sec at the peak
# Supply is fixed and tiny vs demand: ~16:1 buyers-to-seats in minute one
# Most attempts MUST fail fast (seat gone) without corrupting inventory
# Verdict: shed load with a queue + rate limit (D2); make each successful
# claim a strongly-consistent, atomic seat transition (D3) so the
# 60,000 limit is never exceeded by even one seatThe numbers expose the real shape: demand outstrips supply ~16:1 in the first minute, so the system's main job is to reject most attempts safely while letting a controlled few succeed correctly. That dictates the next steps — flatten the spike, then make each winning claim atomic.
D2 — Surviving the on-sale spike: queue + rate limit
- Waiting room: admit buyers through a queue (see Message queues) that releases them to the booking path at a sustainable rate, turning a 16,700/sec wall into a steady trickle.
- Rate limit the booking API per client (see Rate limiting) so bots and retries can't jump the line or amplify the spike.
- Fairness: the queue gives orderly, roughly first-come access — realizing the Phase A fair under spikes principle instead of a chaotic free-for-all.
- Cache the browse path (availability pages) separately so a slightly stale count never pressures the strongly-consistent booking path.
D3 — Reserve-then-confirm: the no-double-booking core
- Reserve (HOLD with a TTL): to claim seat 14C, atomically flip its state
available → heldonly if currently available — a conditional/transactional update, or a short per-seat lock (see Distributed locking). SetholdExpiresAt = now + TTL(e.g. a few minutes). - Exactly one winner: because the transition is atomic, concurrent attempts on the same seat see at most one succeed; the rest fail fast with "seat taken" — no double-booking, ever.
- Confirm (on payment): when payment clears, run an ACID transaction (see ACID transactions) that checks the hold is still valid and owned by this buyer, flips
held → sold, and writes the order — all or nothing. - Expire & release: if payment never completes, the hold's TTL lapses and a sweeper (or a lazy check on the next access) returns the seat to
available, so no seat is ever stranded. - Strong consistency, by design: the seat inventory is the one place we insist on serializable correctness — realizing correctness over availability from Phase A.
-- RESERVE: flip available -> held ONLY if still available (D3).
-- The WHERE clause is the lock: concurrent attempts, at most one updates a row.
UPDATE seat
SET state = 'held',
held_by = :buyer_id,
hold_expires_at = NOW() + INTERVAL '5 minutes'
WHERE seat_id = :seat_id
AND state = 'available';
-- rows_affected = 1 -> this buyer won; 0 -> seat already taken, fail fast.
-- CONFIRM (on payment): atomic held -> sold, still owned and not expired.
UPDATE seat
SET state = 'sold'
WHERE seat_id = :seat_id
AND state = 'held'
AND held_by = :buyer_id
AND hold_expires_at > NOW();
-- A sweeper returns any 'held' seat past hold_expires_at to 'available'.Why reserve-then-confirm, and why not just sell on click or hold forever?
Two simpler designs tempt you and both fail. Sell on click (finalize the sale the instant someone picks a seat) is wrong because payment hasn't happened yet — if the card declines, you've already marked the seat sold, and reversing it is messy. Hold with no expiry (lock the seat until the buyer finishes) strands seats forever whenever someone opens checkout and wanders off, slowly draining your inventory to nothing. Reserve-then-confirm with a TTL threads the needle: the seat is locked long enough to pay, and if payment never comes, the hold lapses and the seat returns to the pool automatically.
| Approach | What it buys | The gap it can't fill |
|---|---|---|
| Sell on click (one step) | Simplest; no hold state. | Marks seats sold before payment clears — declines and abandons leave phantom sales to unwind. |
| Hold with no expiry | Buyer never loses their seat mid-checkout. | Abandoned checkouts strand seats forever; inventory silently drains and never recovers. |
| Reserve-then-confirm + TTL (chosen) | Seat locked while paying; auto-released if unpaid; atomic finalize. | Needs a sweeper/expiry and a two-step flow — a little more machinery for a correct, self-healing system. |
Why an atomic claim, and why not read-then-write?
The naive reserve reads 'is seat 14C available?', sees yes, then writes 'held.' Under a stampede, a thousand requests all read 'available' in the same instant and all write 'held' — a thousand people think they got the seat. The fix is to make the check and the write a single atomic step: the UPDATE ... WHERE state = 'available' above is that step. The database guarantees only one concurrent update matches the row while it still says available; everyone else gets zero rows affected and fails fast. The condition in the WHERE clause is the lock.
| Approach | What it buys | The gap it can't fill |
|---|---|---|
| Read-then-write | Easy to reason about; two plain queries. | A race under load: many requests read 'available' and all write 'held' — mass double-booking. |
| Conditional atomic UPDATE (chosen) | The check and write are one step; exactly one winner per seat. | Hot-seat contention still funnels many requests at one row — shed load upstream with the queue. |
| Pessimistic row lock per seat | Also guarantees one winner. | Holds a lock across the whole claim; heavier and risks lock pile-ups under a stampede. |
D4 — Inventory store & durability
- Inventory store: a transactional store (relational or a store with strong single-key transactions) holding per-seat state; the booking service is its sole writer (see SQL vs NoSQL).
- Orders store: durable records of confirmed sales; replicate for durability (see Replication).
- Idempotency on reserve and confirm (see Idempotency) so a retried request doesn't create a second hold or charge twice.
- Scale by event: partition inventory by eventId (see Sharding) so one mega-event's stampede is isolated from everything else on the platform.
def confirm(seat_id, buyer_id, payment_ref):
with db.transaction(): # ACID: all-or-nothing (D3/D4)
# Finalize only if THIS buyer still holds it and it hasn't expired.
rows = db.execute(
"""UPDATE seat SET state='sold'
WHERE seat_id=%s AND state='held'
AND held_by=%s AND hold_expires_at > NOW()""",
(seat_id, buyer_id))
if rows != 1:
raise HoldLostError # expired or snatched back -> no sale
db.insert_order(buyer_id, seat_id, status="paid", payment_ref=payment_ref)
def sweep_expired_holds():
# Self-healing: any abandoned hold past its TTL returns to the pool.
db.execute("""UPDATE seat SET state='available', held_by=NULL
WHERE state='held' AND hold_expires_at <= NOW()""")D5 — The edge & cross-cutting concerns
- Front everything with a load balancer (see Load balancing); the rate limiter and queue from D2 sit at this edge.
- Observability: trace the reserve→confirm path and alert on hold-to-confirm conversion, expired-hold rate, and any attempt to exceed inventory (see Distributed tracing).
- Consistency posture, explicit: browse counts are eventually consistent, but seat state is strongly consistent (see Consistency models) — two postures, deliberately drawn.
Scaling & bottlenecks — what breaks first
Turn the dial up and booking fails in a predictable order. The spike defense is deliberately out front, so the first thing to buckle is usually contention on the hottest seats — the front-row rows everyone fights over — not the system as a whole.
| Breaks first as you scale | The symptom | The fix |
|---|---|---|
| Hot-row contention | Everyone hammers the same premium seats; atomic UPDATEs on a few rows serialize and stall. | Admit buyers at a controlled rate via the queue; offer best-available instead of letting all pick the same seats. |
| Waiting-room queue overload | The on-sale wave overwhelms even the queue's admission tier. | Scale the queue horizontally; drop/retry excess early; shard the waiting room per event. |
| Expiry sweeper lag | Abandoned holds linger past their TTL, so seats look sold-out that are actually free. | Sweep frequently in small batches, or lazily release on the next read of a seat past its TTL. |
| Confirm-path payment latency | Slow payment providers hold inventory in limbo and lengthen conversion time. | Keep the TTL generous enough to pay but tight enough to recycle; make payment async with an idempotent confirm. |
Phases E & F — Opportunities, Solutions & Migration Planning
- Greenfield, so sequence by risk: ship the reserve-then-confirm flow against a single replicated transactional store for small events first, proving the no-double-booking invariant before scale.
- Add the waiting-room queue and rate limiting before the first big on-sale — the spike defense is useless if added after the stampede.
- Partition by event as volume grows — an independently shippable, reversible step, the same strangler-fig / expand-contract spirit as the TOGAF commerce scenario.
Phases G & H — Governance & Change Management
- Governance (G): define SLOs (e.g. zero oversells ever — a hard invariant, not a percentile; confirm p99 < 2s under load), set per-buyer purchase quotas, and review that the build still honors the Phase A principles — especially correctness over availability.
- Change management (H): adding dynamic pricing, seat maps, or resale is a bounded change, not a re-architecture — because the browse path, the hold mechanism, and the order record were kept on clean boundaries.
Event booking is the canonical "correctness under a stampede" problem — it shows how to hold a hard invariant (never double-sell) while an order of magnitude more buyers than seats arrive at once.
Why it matters
- It teaches the reserve-then-confirm pattern: separate claiming a resource from finalizing it, with a TTL to prevent stranding.
- It makes the spike-defense explicit — a queue and rate limiter shed load before it reaches the correctness-critical core.
- It's a clean case of choosing correctness over availability on purpose, and designing the whole stack around that one invariant.
If ignored
- You oversell seats under concurrency, because the claim wasn't an atomic state transition.
- The on-sale spike melts the booking service, because no queue or rate limit flattened it.
- Seats get stranded in 'held' forever, because holds had no TTL and no release.
Where it fits
- Phase D is the technical core — queue + rate limit, TTL'd atomic HOLD, ACID confirm, expiry release, partitioned inventory.
- Earlier phases (A–C) supply the strong-consistency, fairness, correctness-over-availability constraints; later phases (E–H) handle rollout and the zero-oversell invariant.
- It sits beside the commerce scenario as the high-concurrency, hard-invariant member of the problem set.
Related topics
- ACID transactions: the atomic confirm that turns a hold into a sale all-or-nothing
- Distributed locking: guards the per-seat HOLD so only one buyer claims a seat
- Rate limiting: protects the booking path from the on-sale stampede
- Message queues: the waiting room that flattens the spike into a steady trickle
Interview lens
Questions it unlocks
- Design Ticketmaster / an event-booking system.
- How do you prevent double-booking the same seat under high concurrency?
- How do you survive the traffic spike when a hot event goes on sale?
60-second answer
I'd frame it as an ADM walk. Phase A commits to the hard rule: strongly consistent inventory, fair under spikes, correctness over availability — I'd rather reject than double-sell. Phase B's key insight is that reserving and confirming are two steps: a buyer needs a seat locked while they pay, but the sale isn't final until money clears. Phase C sees the hot operation is a conditional single-seat state transition, so the inventory store needs real ACID transactions. Then Phase D is the design: a waiting-room queue plus rate limiting flatten the on-sale spike and give fair access. To reserve, I atomically flip a seat available-to-held only if available, with a TTL hold — so concurrent attempts see exactly one winner and the rest fail fast, no double-booking. On payment an ACID transaction flips held-to-sold and writes the order; if payment never completes the TTL lapses and the seat is released. Inventory is strongly consistent and partitioned by event; browse counts can be eventually consistent. E–H ship the flow first, add the queue before the first big on-sale, and govern a zero-oversell invariant. Every Phase D mechanism traces back to the never-double-book principle.
Common traps
- Treating reserve and confirm as one step, so a seat is sold before payment clears or locked forever if it fails.
- Making the seat claim non-atomic (read-then-write) so two buyers both win seat 14C under concurrency.
- Forgetting the spike defense — no queue or rate limit — so the on-sale stampede overwhelms the correctness core.