Design an Ad Auction
HardSystem design · Ads
Design the serving side of an ad system. Given an ad request for a page or feed slot, select eligible campaigns, rank and price them in a single auction, return the winner within the latency deadline, and emit the events that billing depends on.
In scope: candidate retrieval, response prediction at a high level, auction and pricing rules, budget pacing, and impression and click events. Out of scope: campaign creation UI, model training pipelines, and the downstream click-fraud and attribution system.
Requirements
- Match campaigns to user, context and targeting rules, then rank by bid times predicted action rate
- Return a result by the deadline even if some stages are slow, by degrading rather than failing
- Never let budgets overspend meaningfully, despite a million auctions a second across many nodes
- Produce impression and click events that are exact enough to bill on, with deduplication and a verifiable token