
DynamoDB Data Modeling Challenge #2 - Results
Highlighting successful data models submitted to The Fair Seat Purchase — Selling 100,000 Tickets Without Overselling a Single One
When the waiting room empties, the next problem begins. Challenge 2 picked up where Challenge 1 left off: fans have cleared the queue and are now racing to buy tickets. The system must guarantee that every seat is sold exactly once while holds expire automatically and the seat map stays live.
In this article we’ll review three proposed solutions to that problem. Where Challenge 1 was about absorbing write volume, Challenge 2 was about mutual exclusion under concurrency. There are fewer total writes, but every one must be correct.
1. A Live-Deployed Reference Application With Sharded Sweep
This submission is a fully deployed, live reference application backed by a single-table DynamoDB design with two GSIs. The central idea: the conditional write is the only correctness mechanism. Every hold attempt checks
Seat_Status = available OR holdExpiresAt < :now in a single conditional UpdateItem. Concurrent contenders serialize on the item ensuring that exactly one wins while the rest receive ConditionalCheckFailedException. Confirmation uses TransactWriteItems to atomically flip the seat to sold and stamp the transaction.DynamoDB's native TTL is deliberately not the release mechanism. The same item represents both the seat and its hold status. TTL deletes whole items, but a seat must survive and return to available. Instead, correctness rests on condition-at-read-time: an expired hold is treated as available in every guard expression, regardless of whether cleanup has run. A background sweeper exists for visual freshness only, using a write-sharded GSI (
HOLDS#<shard> ) to avoid creating a hot partition during the sweep.GSI1 is sparse — GSI keys are written only while a seat is available, removed on hold/sell — so a section's seat-map query returns exactly the available seats with no filter and no wasted reads. The submission includes a CloudFront-hosted UI with real-time colour-coded seat maps, CDK deployment, and property-based tests with vitest + fast-check.
2. A Dual-Item Model Where Cleanup Is Never Load-Bearing
This submission's design principle is stated plainly: "If a background process being slow could ever let two fans win the same seat, the design is wrong." To enforce that principle structurally, each seat is split into two items sharing the same partition: a durable seat record (never deleted) and an ephemeral hold ticket (TTL-managed). TTL applies exclusively to the hold ticket. When it expires, a Streams-consuming Lambda conditionally resets the seat record to available, but if that Lambda is slow or briefly down, correctness is never at risk — new hold attempts check the seat record's own
holdExpiresAt directly.Placing a hold is a TransactWriteItems call: update the seat record (condition: available OR expired) and put the hold ticket. Confirmation is a three-operation transaction: update seat to SOLD, delete the hold ticket, and put the purchase record — all-or-nothing. A client-generated
purchaseId makes confirmation idempotent: a retried request safely fails against an already-SOLD condition instead of double-charging.The submission walks through six explicit failure scenarios (payment timeout, Streams redelivery, concurrent 5ms race) and proves each resolves correctly. It also includes a stretch-goal COUNTS item per section (availableCount, heldCount, soldCount), updated by Streams, explicitly documented as display-only and never on the correctness path.
3. A Full-Stack MVP With Concurrency Proof
This submission is a production-style MVP: React frontend, Lambda backend, CDK deployment, and a concurrency test that fires 100 simultaneous requests at the same seat and proves exactly one succeeds (the other 99 get HTTP 409). The design uses the same conditional write pattern —
status = AVAILABLE OR holdExpiresAt < :now — with TransactWriteItems for the checkout step.Hold expiration uses a dual strategy: passive condition checks on every hold attempt (correctness) plus a scheduled EventBridge Lambda every two minutes for visual freshness (so the seat map doesn't show stale held seats). The submission includes a detailed trade-off table comparing the two approaches and why both are needed.
Similarities and Differences
All three submissions independently converged on the same core insight: the conditional write is the sole correctness mechanism for preventing double-sells.
The submissions differed in several areas, however. The first and third keep each seat as a single item and relies on inline condition checks to treat expired holds as available. The second structurally separates the seat from its hold by splitting them into two items. Both are correct, but the single-item approach is arguably the stronger production choice — it's simpler, cheaper on the hot path (one conditional UpdateItem vs. a TransactWriteItems), and self-contained: all the state you need to reason about a seat lives on one item. The dual-item approach trades that simplicity to use TTL deletes and DynamoDB streams to purge stale holds instead of the sweepers used by the other implementations.
Maybe there’s another option to consider instead.
Taking These Designs Further
All three submissions solve the correctness problem. For builders looking to push these patterns toward production, here are some design tensions worth thinking about.
Do you need a status field at all? All three submissions maintain an explicit status enum (
AVAILABLE / HELD / SOLD ) and then invest significant design effort in resetting that status when holds expire — sweepers, Streams Lambdas, sharded GSIs for finding stale holds. But consider the alternative: a seat is either sold (permanent — soldAt is set), actively held ( holdExpiresAt > now ), or free (neither). The frontend computes which state applies at read time from the timestamps alone. No sweep, no cleanup writes, no Streams consumer, no sharded GSI2 — and the seat map is always perfectly accurate because availability is derived from the current clock, not from whenever a background process last ran. The trade-off is that you lose the ability to pre-filter available seats with a sparse GSI key condition, but a section is typically a few hundred to a few thousand seats — reading all of them and computing status client-side is a single-digit-millisecond Query that costs less than the GSI write overhead saved on every hold and release. The correctness condition expression works identically either way.Transaction scope on the hold path. Transactions are essential when multiple items need to move atomically (seat + purchase record at confirmation). But on the hold path — where only one item changes — a single conditional UpdateItem costs half the WCU and serializes faster than a TransactWriteItems call. It's worth asking whether the hold step genuinely requires a transaction, or whether that's a leftover from the confirmation step's pattern. In the dual-item approach (seat record + hold ticket), the transaction is structurally necessary. In the single-item approach, it isn't.
Section popularity and partition heat. All three designs partition seats by section, which means popular sections (VIP, front row) receive disproportionate write pressure. At the scale of this challenge (hundreds of concurrent fans, a few hundred seats per section), that's comfortably within DynamoDB's per-partition ceiling. But for larger venues or higher concurrency, it's worth asking: at what point does a section become hot enough to benefit from further splitting (per-row, or sharded within a section), and what does that do to the browsing query that needs to render the full section in one shot?
Retry semantics. What happens when a client's hold request times out and they retry — but the first attempt actually succeeded? The second attempt hits a seat that's already held by them. The cleanest designs treat this as a success (idempotent hold), not an error. Similarly, a retried purchase confirmation should recognize "already SOLD to this fan" as success, not trigger a duplicate charge path. The designs that surface client-generated idempotency tokens handle this most explicitly.
Winners
All submitted models passed requirements. Thanks for sharing your entries!
Join the NoSQL Launchpad in Builder Center — that's where AWS NoSQL specialists knowledge share, review designs, and help teams pressure-test their DynamoDB configurations before the stakes are real.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article