KatInterview

Live Bidding Engine: Ordering, Contention and Push Updates

System DesignModel answer
MediumModel answerSystem Designsystem-designreal-timeconcurrency

Last updated

Design a live bidding service that handles bursts of bids on popular items, keeps a strict per-item order, never loses accepted bids, and streams the leading bid to viewers.

You are asked to design the backend for an online bidding service where sellers list items and buyers compete to win them before a deadline.

What users can do

  • Open a listing and see its details, the current leading bid, and the history of bids.
  • Place a bid.
  • Watch the leading bid and new bids change live, without refreshing.

Load and correctness expectations

  • Some listings become extremely popular. In the last 30 seconds before the deadline, one listing may see a flood of bid attempts and a very large audience watching it.
  • Bids for a single listing must be applied in a well-defined order.
  • Invalid or stale bids (too low, late, or for a closed listing) must be rejected.
  • Every accepted bid and every change in listing state must be stored durably.
  • When the deadline passes, the system must close the listing and declare the winning bid.

What to cover in your answer

  1. The client-facing APIs: reading a listing, placing a bid, and subscribing to live updates.
  2. The bid write path when many people compete for the same listing at once.
  3. The mechanism for pushing live updates (for example SSE or WebSocket).
  4. Storage choices for listing metadata, bid history, the current leading bid, and event delivery.
  5. Consistency, idempotency, ordering, failure handling, and how you scale for a very hot listing.

State your assumptions about traffic (concurrent viewers, bid rate, peak per-listing rate) before designing.

Hints

Hint 1

Find the real hot spot first: a single listing's leading-bid record is written by thousands of bidders and watched by a huge audience. Reads and fan-out dwarf accepted writes.

Hint 2

Give every listing its own monotonically increasing sequence number. It solves ordering, gap detection on the client, resume after reconnect, and gives you a natural fencing/versioning field.

Hint 3

Start with a conditional, transactional write (accept only if the amount beats the current leader by the increment and the listing is open), then ask what breaks under heavy contention and consider a single owner per listing that pre-filters stale bids and batches commits.

Hint 4

Separate the durable write from delivery: commit the bid and an outbox event in one transaction, publish through a log partitioned by listing, and coalesce updates to viewers at a bounded rate.