Online Auction System (like eBay)¶
Quick Reference Guide for System Design Interviews
Problem Statement¶
Design an online auction platform where sellers can list items for bidding, buyers can place bids, and the system automatically manages auction lifecycles, determining winners and processing payments.
Requirements¶
Functional Requirements¶
- Create auction listings
- Place bids on items
- Real-time bid updates
- Automatic auction closure
- Winner determination
- Bid history
Non-Functional Requirements¶
- Consistency: No overselling, correct winner
- Availability: 99.99%
- Latency: < 100ms for bid placement
- Scale: 10M concurrent auctions, 1M bids/minute
High-Level Architecture¶
Auction Data Model¶
-- Auctions table
CREATE TABLE auctions (
auction_id UUID PRIMARY KEY,
seller_id UUID NOT NULL,
title VARCHAR(500),
description TEXT,
category VARCHAR(100),
starting_price DECIMAL(12,2) NOT NULL,
reserve_price DECIMAL(12,2), -- Minimum to sell
buy_now_price DECIMAL(12,2), -- Instant purchase
current_price DECIMAL(12,2),
bid_increment DECIMAL(12,2) DEFAULT 1.00,
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NOT NULL,
status VARCHAR(20) DEFAULT 'pending',
-- pending, active, ended, sold, cancelled
winner_id UUID,
winning_bid_id UUID,
created_at TIMESTAMP DEFAULT NOW(),
INDEX idx_status_end (status, end_time),
INDEX idx_category (category),
INDEX idx_seller (seller_id)
);
-- Bids table
CREATE TABLE bids (
bid_id UUID PRIMARY KEY,
auction_id UUID NOT NULL REFERENCES auctions(auction_id),
bidder_id UUID NOT NULL,
amount DECIMAL(12,2) NOT NULL,
max_amount DECIMAL(12,2), -- For proxy bidding
status VARCHAR(20) DEFAULT 'active',
-- active, outbid, winning, cancelled
created_at TIMESTAMP DEFAULT NOW(),
INDEX idx_auction_amount (auction_id, amount DESC),
INDEX idx_bidder (bidder_id)
);
-- Bid history (denormalized for fast reads)
CREATE TABLE bid_history (
auction_id UUID,
bid_id UUID,
bidder_id UUID,
amount DECIMAL(12,2),
created_at TIMESTAMP,
PRIMARY KEY (auction_id, created_at, bid_id)
);
Bid Placement Flow¶
Proxy Bidding (Auto-Bidding)¶
Auction Lifecycle¶
Real-Time Updates¶
Concurrency & Consistency¶
Interview Discussion Points¶
- How do you handle concurrent bids?
- Distributed lock or optimistic locking
- Atomic operations in Redis
-
Last valid bid wins
-
How do you ensure correct winner?
- Strong consistency for bid processing
-
Transaction for bid + auction update
-
How do you handle auction ending?
- Scheduled job or delayed queue
-
Process at exact end time
-
How do you implement proxy bidding?
- Store max bid
-
Auto-increment on competing bids
-
How do you prevent sniping?
-
Extend auction on last-minute bids
-
How do you scale hot auctions?
- Redis for current price
- Async persistence
- Rate limit bid frequency