Online Auction

Real-time Bidding & Auction Platform

Design an auction site where sellers list items for a fixed time, bidders raise the price live, and exactly one highest valid bid wins when the auction closes.

Overview

An online auction lists an item for a fixed time. Bidders offer more and more; when the time runs out, the highest valid bid wins, if it meets the seller's reserve (a hidden minimum price).

The data per auction is small, and most auctions get only a few bids. The hard part is the order of events on one auction. Two bids can arrive in the same millisecond, and many bids arrive in the last minute. The system must decide each bid against the price at that exact point, keep every accepted bid, and draw a clean line at the close: every bid before it counts, every bid after it is refused.

Most sites also let a bidder enter a secret maximum and bid for them automatically, one increment at a time, up to that amount. This is usually called proxy or automatic bidding, and it changes how the price is computed.

Questions to ask first

  • How many auctions and bids? — 10 million open at once, 7 days long, about 10 bids each
  • Proxy bidding? — Yes; the maximum stays secret
  • What happens to a last-second bid? — Soft close: a bid in the last 2 minutes pushes the end to 2 minutes after that bid
  • Reserve price? — Optional and hidden; no sale if the price stays below it
  • Buy it now? — Out of scope for the core; mentioned in the questions
  • How live is live? — Watchers see a new price within about a second

What you will be able to do

  • Serialize bids per auction and explain why that scales.
  • Compute the price under proxy bidding, including ties and the reserve.
  • Close auctions on time with no late bids and no double closes.
  • Explain soft close and what it does to last-second bidding.
  • Push live prices to watchers without touching the bid path.

Key concepts

  • Per-auction ordering
  • Row lock per auction
  • Proxy bidding
  • Bid increment
  • Soft close
  • Closing sweeper
  • Append-only bid log
  • Live updates by WebSocket
  • Reserve price

Functional requirements

  • Sellers create auctions with start price, increment, optional reserve and end time
  • Bidders place a bid with a secret maximum; the system bids for them up to it
  • Refuse bids below the current price plus one increment, and bids after the close
  • A bid in the last 2 minutes pushes the end to 2 minutes after it (soft close)
  • Watchers see the current price and end time update live
  • At the close, pick the winner (if the reserve is met) and notify everyone who bid

Non-functional requirements

  • Every accepted bid is stored durably before the bidder is told it was accepted
  • Bids on one auction are decided in one order; no two bidders both lead at the same price
  • A bid answers in under 300 ms at p99 (a target we chose)
  • Watchers see a new price within about 1 second
  • An auction closes within a few seconds of its end time, exactly once

Interview questions

  • How do you handle two bids on the same auction at the same time?
  • How does proxy bidding decide the price?
  • How do you close auctions on time without double closing?
  • What is sniping, and how do you handle it?
  • How do watchers see the price live without hurting bidding?
  • How do you shard the data?
  • What if one auction is extremely hot?
  • How would you add Buy It Now?

Sign up free to read the full topic

More System Design topics

Start free on Cariara · Coding problems · System design studio