eBay / Auction System#
Problem statement (interviewer prompt)
Design an online auction system (eBay): listings with bidding, proxy bidding (auto-rebid up to a max), live leaderboard, anti-snipe extensions, winner determination, and payment + shipping handoff. Strictly serialise bids per listing.
flowchart LR
S[Seller]
L[Listing Service]
A[Auction Engine]
B[Bidder]
PAY[Payment]
S --> L
B --> A
L --> A
A --> PAY
classDef client fill:#dbeafe,stroke:#1e40af,stroke-width:1px,color:#0f172a;
classDef edge fill:#cffafe,stroke:#0e7490,stroke-width:1px,color:#0f172a;
classDef service fill:#fef3c7,stroke:#92400e,stroke-width:1px,color:#0f172a;
classDef datastore fill:#fee2e2,stroke:#991b1b,stroke-width:1px,color:#0f172a;
classDef cache fill:#fed7aa,stroke:#9a3412,stroke-width:1px,color:#0f172a;
classDef queue fill:#ede9fe,stroke:#5b21b6,stroke-width:1px,color:#0f172a;
classDef compute fill:#d1fae5,stroke:#065f46,stroke-width:1px,color:#0f172a;
classDef storage fill:#e5e7eb,stroke:#374151,stroke-width:1px,color:#0f172a;
classDef external fill:#fce7f3,stroke:#9d174d,stroke-width:1px,color:#0f172a;
classDef obs fill:#f3e8ff,stroke:#6b21a8,stroke-width:1px,color:#0f172a;
class S,L,A,B,PAY service;
flowchart TB
subgraph Clients
SEL[Seller]
BID[Bidder]
end
subgraph Edge
CDN
GW
end
subgraph Listing
LSVC[Listing Service]
LDB[(Listings)]
IMG[Images / S3]
end
subgraph Search
SRCH[Search]
IDX[(Inverted index)]
REC([Recommendation])
end
subgraph Auction[Auction Engine]
AUC[Auction Service<br/>per-item shard]
AUCDB[(Auction state<br/>strong consistency)]
PROXY[Proxy bidding<br/>auto-rebid up to max]
SNIPE[Anti-snipe extension]
TICK[Closing clock]
NTQ[(Pending bids queue)]
end
subgraph Pay
PAYWIN[Winner payment service]
PAYSTRIPE((Payment provider))
HOLD[Authorization hold]
end
subgraph Notif
WS[[WebSocket / SSE bid stream]]
PUSH[Push / email]
end
subgraph Trust
FRAUD[Fraud detection]
DISP[Dispute / chargeback]
SAFE[Buyer/seller protection]
end
subgraph Real
LB[Auction LB<br/>sticky by listing_id]
end
SEL --> Listing
Listing --> Search
BID --> CDN --> GW --> LB --> Auction
Auction --> AUCDB
AUC --> PROXY
AUC --> SNIPE
AUC --> NTQ
Auction --> Notif
Auction -. winner .-> Pay
Trust --- Pay
classDef client fill:#dbeafe,stroke:#1e40af,stroke-width:1px,color:#0f172a;
classDef edge fill:#cffafe,stroke:#0e7490,stroke-width:1px,color:#0f172a;
classDef service fill:#fef3c7,stroke:#92400e,stroke-width:1px,color:#0f172a;
classDef datastore fill:#fee2e2,stroke:#991b1b,stroke-width:1px,color:#0f172a;
classDef cache fill:#fed7aa,stroke:#9a3412,stroke-width:1px,color:#0f172a;
classDef queue fill:#ede9fe,stroke:#5b21b6,stroke-width:1px,color:#0f172a;
classDef compute fill:#d1fae5,stroke:#065f46,stroke-width:1px,color:#0f172a;
classDef storage fill:#e5e7eb,stroke:#374151,stroke-width:1px,color:#0f172a;
classDef external fill:#fce7f3,stroke:#9d174d,stroke-width:1px,color:#0f172a;
classDef obs fill:#f3e8ff,stroke:#6b21a8,stroke-width:1px,color:#0f172a;
class LB edge;
class SEL,BID,LSVC,SRCH,AUC,PROXY,SNIPE,TICK,PAYWIN,HOLD,PUSH,FRAUD,DISP,SAFE service;
class LDB,IDX,AUCDB,NTQ datastore;
class WS queue;
class REC compute;
class IMG storage;
class PAYSTRIPE external;
Auction correctness#
- All bids for a listing must serialize on a single owner (shard by
listing_id). - Each bid: validate amount ≥ current + increment, atomic CAS update, persist event.
- Replicate to followers; reads from followers may show stale leaderboard - that's acceptable.
Proxy bidding#
- Bidder sets
max_bid; system auto-rebids minimum required up to max. - Stored as private field; visible to all is current high-bid only.
Anti-snipe#
- Last-minute bid extends auction by N seconds.
- Prevents server-clock gaming + last-second sniping.
Glossary & fundamentals#
Concepts referenced in this design. Each row links to its canonical page; the tag column shows whether it is a high-level (HLD) or low-level (LLD) concept.
| Tag | Concept | What it is | Page |
|---|---|---|---|
HLD |
CDN | edge caching for static assets | cdn |
HLD |
Sharding | horizontal partitioning across nodes | database-sharding |
HLD |
CAP / PACELC | C vs A under partition; L vs C otherwise | cap-pacelc |
HLD |
Leader/follower replication | sync/semi-sync/async replication, failover | replication-leader-follower |
HLD |
Realtime protocols | WS / SSE / polling / gRPC streaming | realtime-protocols |
HLD |
Search internals | inverted index, BM25, embeddings, ANN | search-internals |
LLD |
Structural patterns | Adapter, Decorator, Facade, Proxy, Composite | structural-patterns |
LLD |
Concurrency primitives | mutex, semaphore, RW lock, atomic, CAS | concurrency-primitives |
Quick reference#
Functional#
- List item (auction / Buy It Now).
- Bid placement, proxy bidding.
- Live leaderboard, countdown.
- Winner determination + payment + shipping.
- Disputes & buyer/seller protection.
Non-functional#
- Strict ordering of bids per listing.
- p99 bid placement < 500 ms.
- Active listings: tens of millions.
Capacity#
- 1B+ listings/yr; tens of millions live concurrently.
- Bid storm at auction close: 1000s bids/s on hot items.
Schema#
listings(id, seller, type, start, end, current_high_bid, status)bids(id, listing_id, bidder, amount, max_amount, ts)partition by listing_idpayments(...)similar to Amazon
Trade-offs#
- Single-owner per listing is required for correctness.
- Eventual consistency on viewer leaderboard is fine.
- Anti-snipe extension keeps fairness but breaks fixed-time scheduling.
Refs#
- eBay engineering blog (Cassandra rollouts, auction architecture talks).
- "Designing Data-Intensive Applications" ch.7 (transactions).
- ByteByteGo "Design an auction".
FAQ#
How does eBay prevent two bidders from winning the same auction?#
Bids per listing are serialized through a single owner shard or a row level lock. Each bid is compared against the current high bid and accepted or rejected atomically before notifications fire.
What is proxy bidding in eBay?#
A bidder enters a maximum price. The system bids the minimum needed to keep them on top, up to that maximum, so they don't need to manually re-bid every time someone outbids them.
How does eBay handle anti sniping near auction end?#
If a bid arrives in the last few seconds, the auction is extended by a fixed window. This prevents last instant snipes from winning without giving others a chance to respond.
How are auction expiries scheduled at scale?#
Each auction's end time goes into a delay queue or scheduled job store. A worker pool picks up expired auctions, determines the winner, charges payment, and notifies both parties.
How does eBay search rank live listings?#
Listings are indexed in a search engine with relevance signals like keyword match, seller reputation, ship time, price, and personalization. Ending soon and best match rankers are exposed as sort options.