64. Design for Contention: Thousands Racing for the Same Item
Design for contention through a limited sneaker drop: row locks, conditional writes, expiring holds, fencing tokens, sagas and one writer per item.
Start with a template. Work through each step. Ask Coach when you need a second opinion.
Company tags are community-reported. Counts on cards show how many people reported that design.
Design for contention through a limited sneaker drop: row locks, conditional writes, expiring holds, fencing tokens, sagas and one writer per item.
An order checkout across payment, inventory and shipping, run as a saga.
Nights as counted inventory, holds that never double-book, search that knows availability, and payments that reconcile.
Dish reviews only from customers who ordered them, votes counted from a change stream, reviews ranked by the Wilson bound, payouts made exactly once.
Ten charities, three days, $100 M: charge through a third-party processor exactly once, queue the broadcast spikes, keep live totals on sharded counters. One-hour boards for junior, senior and staff, with the theory behind them.
Buy the cheapest offer under a maximum price from 1,000 sellers: cached offers, coalesced quotes, a hold-order-capture saga, open requests.
Real-time rated chess with server-validated moves, lag-compensated clocks, pairing by rating and a million watchers on one game.
Rank 200 million players in real time with sharded Redis sorted sets, count every game exactly once, and close a season fairly.
Design a team chat app like Slack: channels and DMs in real time, threads, unread counts and search. One-hour boards for junior, senior and staff, with the theory behind them.
Find restaurants that deliver to you, check out without double charges, time couriers to the kitchen and track them live.
Record every money movement as balanced, append-only entries, exactly once, with holds, payouts and reconciliation.
One set of tags across Jira issues, Confluence pages and Bitbucket pull requests: batch renders, tag pages that never leak, suggestions, popular tags.
Signed HTTPS callbacks for a billion events a day, at least once, retried for three days, with no endpoint able to slow another.
The URL shortener with a payload: the same id generation and cache-first read path, but the value is kilobytes of text, so it moves out of the database and into object storage.