call(back)

Design a Real-Time Auction

Design an auction service in which popular auctions receive heavy reads and writes at once. Users submit bids through a REST endpoint. The system validates each bid, processes the bids of one auction in a well-defined order, keeps the current highest bid, and pushes the highest price and the bid history to everyone watching in real time.

Every bid and the auction's own state must be stored durably, not just the winning record. Many users will bid on the same auction in the same second, particularly in the closing moments. Explain how stale bids are rejected, how a retried bid is handled, and how an auction is closed exactly once.

Hints

Hint 1

Ordering only matters within one auction. Partition by auction id and let each auction's bids be handled by one consumer at a time.

Hint 2

The accept-or-reject decision needs a single serialisation point: either the partition's worker or a conditional update on the auction row.

Hint 3

Watchers mostly receive. Server-sent events fit that; keep WebSocket for the cases that need it.

Asked at

Similar Problems5