Coordination, Money & Markets

Locks, idempotency, payments, auctions, and inventory.

Learn the reason behind each component

5 independent guides. Each includes local concept explanations, a correctness contract, a worked failure trace, and a runnable Python learning model.

Read in this order: requirements → concepts → data flow → concurrency and failure behavior → sizing → worked example. Explain what can fail before choosing a technology.

01·Distributed Lock / Leader ElectionCoordinate work without letting expired, paused holders corrupt protected resources. 02·Idempotency / Exactly-OnceMake repeated API attempts produce one logical effect despite concurrent retries and uncertain remote outcomes. 03·Payment / Wallet SystemRepresent money as auditable postings and enforce balances, currency, and retries transactionally. 04·Ad Auction / Real-Time BiddingAllocate ads under specified pricing, deadlines, and spend/exposure accounting. 05·Ticket Booking (Inventory)Hold scarce seats during checkout and reject stale payment or expiry callbacks.

Find a guide or concept

5 guides

Designing an Ad Auction

Allocate ads under specified pricing, deadlines, and spend/exposure accounting.

First-price, second-price, and GSP · Budget reservations and pacing · Token bucket · Deduplication · Backpressure and load shedding · Wall and monotonic clocks

Designing a Distributed Lock — A System Design Interview Guide

Coordinate work without letting expired, paused holders corrupt protected resources.

Leases · Fencing tokens · Quorum · Raft terms and commit rules · Optimistic concurrency and compare-and-set · Wall and monotonic clocks

Designing for Idempotency & Exactly-Once — A System Design Interview Guide

Make repeated API attempts produce one logical effect despite concurrent retries and uncertain remote outcomes.

Idempotency keys · Optimistic concurrency and compare-and-set · Transactional outbox · Sagas and compensation · Leases · Offsets and checkpoints

Designing a Payment / Wallet System — A System Design Interview Guide

Represent money as auditable postings and enforce balances, currency, and retries transactionally.

Double-entry ledger · Optimistic concurrency and compare-and-set · Idempotency keys · Sagas and compensation · Transactional outbox · CAP and consistency models

Designing a Ticket Booking System — A System Design Interview Guide

Hold scarce seats during checkout and reject stale payment or expiry callbacks.

Optimistic concurrency and compare-and-set · Leases · Idempotency keys · Sagas and compensation · Fencing tokens · Backpressure and load shedding

Download the Python concept models · Python 3.10+, no packages required.

Student clarity and correctness review · 19 October 2026