KatInterview

Live Bidding on Creator Posts: Hot-Auction Backend Design

System DesignModel answer
MediumModel answerSystem Designsystem-designconcurrency-controlreal-time

Last updated

Design a backend where creators run timed auctions on posts, bids are ordered correctly under extreme contention, and millions of watchers see the leading bid within a fraction of a second.

Live bidding on creator posts

You are building a feature for a very large photo and video sharing platform. A creator can turn a post into a timed auction. Viewers place bids, and everyone looking at the post should see the current top bid with minimal delay.

Most auctions are quiet: a handful of bids and a few hundred viewers. Occasionally a celebrity runs one, with millions of viewers and a flood of bid attempts in the closing seconds.

What to cover

  1. Requirements: functional and non-functional, plus the scale numbers you assume.
  2. APIs: creating an auction, placing a bid, reading state, and subscribing to live updates.
  3. Data model: what is stored, where, and what the source of truth is.
  4. High-level architecture: the main components and how a bid flows through them.
  5. Bid ordering and concurrency: how you guarantee that each accepted bid beat the state right before it, and that there is exactly one winner.
  6. Real-time top-bid distribution: how updates reach millions of watchers cheaply.
  7. Scaling hot auctions: what changes for the celebrity case.
  8. Failure handling: node crashes, retries, duplicate submissions, and clock issues.

Specific question to address

Compare optimistic locking with pessimistic locking and with routing all bids for an auction through a single writer. Explain why, for highly contended auctions, queuing or serializing bids is usually preferable to optimistic retries.

Hints

Hint 1

Start by writing down the invariant: the top bid only goes up, and every accepted bid must exceed the state immediately preceding it. What gives you a total order per auction?

Hint 2

Estimate what happens with optimistic version checks when thousands of bidders read the same version at once. How many succeed per round, and what do the losers do next?

Hint 3

Fan-out is likely your largest cost, not the bid writes. Think about coalescing updates, sending sequence numbers, and a tree of broadcast nodes instead of one publisher talking to every watcher.