Online Auction Systems
Asked of: Software Engineer
Last updated

What's being tested
These prompts test whether you can design a real-time distributed system whose correctness depends on ordering, concurrency control, and low-latency fanout—not merely draw services and databases. You must translate ambiguous product behavior such as proxy bidding, reserve prices, buy-it-now, and soft close into explicit invariants and APIs. Meta cares because high-scale social and marketplace features require engineers to preserve user-visible correctness under contention, retries, partial failures, and regional traffic while meeting latency and availability goals.
Core knowledge
-
Requirements and scale modeling should establish auction count, bid rate, watcher fanout, regions, item duration, and latency SLOs. For example, 500k active auctions and 5M watchers imply connection management and fanout dominate storage; estimate average and peak bids separately.
-
The central invariant is that each auction has one authoritative ordered history: a bid is accepted only if valid against the latest state, and every observer sees a sequence consistent with that order. Use a per-auction monotonic sequence number, not client timestamps, to define ordering.
-
Proxy bidding stores each bidder’s maximum willingness and computes the displayed price from the highest and second-highest eligible maxima plus the minimum increment. Never expose the maximum bid; recomputation must be deterministic and atomic when two bids arrive concurrently.
-
A practical concurrency model is single-writer ownership per auction: route all commands for an auction to one partition leader or actor. This avoids distributed locks; optimistic compare-and-set can work at lower contention, while a global lock or cross-region transaction usually harms availability and latency.
-
Partition by
auction_idusing consistent hashing or a durable log partition key. Keep all bid mutations for one auction together, but do not assume one partition can handle every hot auction; isolate celebrity or flash-sale auctions and apply bounded admission control. -
Use an append-only event log for accepted bids and state transitions, plus a materialized current-state view for reads. Events support replay and auditability; snapshots prevent replaying millions of bids. Persist the winning decision before emitting “you won” notifications.
-
Idempotency is required because clients and gateways retry. Require a client-generated
bid_idor idempotency key, deduplicate it per bidder and auction, and return the original result. A timeout must not cause a second accepted bid or a second charge. -
Separate the command path from the read/fanout path. The command service validates and orders bids; a stream processor updates read models; WebSockets or server-sent events push updates. Pushes may be duplicated or delayed, so clients must reconcile using sequence numbers and fetch current state.
-
Soft close extends an auction when a qualifying bid arrives near expiration. Define whether the extension is based on server receipt time or committed sequence time, make the deadline update part of the same serialized state transition, and use server time to prevent client-clock manipulation.
-
Choose consistency intentionally: bid acceptance and winner selection require linearizable behavior per auction, while watch counts, search indexes, and historical analytics can be eventually consistent. Cross-region active-active writes complicate ordering; prefer a home region or explicitly tolerate failover fencing and brief write unavailability.
-
API design should include
CreateAuction,PlaceBid,GetAuction, and a watch subscription.PlaceBidshould return accepted/rejected status, authoritative sequence, current displayed price, deadline, and reason; validate auction status, seller ownership, currency, increment, reserve, and buy-it-now rules server-side. -
Backpressure and failure handling matter more than a nominal throughput number. Bound queues, reject or shed noncritical notifications before bid commands, use timeouts and circuit breakers, and monitor
p99bid-to-ack latency, rejected bids, duplicate rate, lag, connection count, and disagreement between projected state and replayed state.
Worked example
For “Design an online auction platform”, I would first clarify whether proxy bidding, reserve prices, buy-it-now, soft close, payments, and global bidding are required, then declare a target such as 500k active auctions, 5M watchers, and a p99 bid-to-UI latency target. I would organize the answer around four pillars: auction and bid data models, per-auction ordering and concurrency, durable persistence with recovery, and real-time read fanout. Each auction would have a single logical writer selected by auction_id, with an idempotent bid command producing an ordered event and updated materialized state. A partitioned event stream and snapshots would support replay, while WebSockets would distribute updates carrying sequence numbers. I would explicitly choose a home region per auction rather than pretend that multi-region active-active writes can provide simple global ordering. I would explain failover fencing so an old leader cannot continue accepting bids after ownership changes. I would close by saying that, with more time, I would detail payment authorization, fraud controls, load testing for hot auctions, and a rollout plan with shadow event processing.
A second angle
For “Design an online auction system”, the interviewer may emphasize API design, throughput estimation, and partitioning rather than the richer marketplace feature set. The same per-auction serialization principle still applies, but the discussion should begin with traffic math and the boundary between synchronous bid acceptance and asynchronous notification. A useful contrast is that reads can be served from replicated materialized views, while writes must be routed to the auction’s owner. I would also discuss how a hot auction can violate otherwise reasonable partition assumptions and require dedicated capacity or admission control. The answer should preserve correctness even if real-time delivery is delayed, since clients can recover through sequence-aware reads.
Common pitfalls
Pitfall: Treating “latest timestamp wins” as ordering is analytically wrong. Clock skew and simultaneous requests make timestamps unsafe; define order at the serialized server or partition owner and return that authoritative sequence.
Pitfall: Jumping directly to
Kafka,Redis, and WebSockets without stating invariants makes the design sound like a technology inventory. Explain what each component guarantees, what can be stale, and which operation is the source of truth.
Pitfall: Saying “use a distributed lock” for every bid avoids the hard concurrency question. A stronger answer compares per-auction single-writer routing, optimistic version checks, and lock-based coordination, then explains contention, failure recovery, and fencing for the selected approach.
Connections
The interviewer may pivot to leader election, exactly-once effects versus at-least-once delivery, event sourcing, or WebSocket connection scaling. Be prepared to discuss payment idempotency, cache invalidation, hot-key mitigation, and disaster recovery without weakening the per-auction ordering invariant.
Further reading
- Designing Data-Intensive Applications — Martin Kleppmann’s treatment of replication, partitioning, event logs, consistency, and stream processing.
- The Log: What every software engineer should know about real-time data’s unifying abstraction — foundational discussion of append-only logs and their role in distributed systems.
Practice questions
Related concepts
- Auctions, Ticketing, And Real-Time MessagingSystem Design
- Large-Scale Marketplace System DesignSystem Design
- Order Book And Matching Engine Data StructuresCoding & Algorithms
- Meta Ads Ranking, Auction, And Relevance
- Order Book Data Structures And Market Data AggregationSoftware Engineering Fundamentals
- Limit Order Book Price-Time MatchingCoding & Algorithms