Design Google Ads Bidding System
Real-time ad auction — relevance, bid, quality score, and millisecond ranking at search scale.
Interview tip Clarify GSP vs VCG auction, quality score, budget pacing, and fraud filtering before ranking.
① Functional requirements
- Advertisers set bids and budgets
- Match ads to query keywords + intent
- Run auction per search impression
- Track clicks and conversions
- Budget pacing through the day
- Policy and fraud filtering
② Non-functional requirements
- Auction p99 < 50ms
- 100K QPS auction peak
- Billing accuracy — no double charge
- Global multi-currency
③ Back-of-the-envelope scale
Assumptions
- 100K auctions/sec
- Millions of active campaigns
- Inverted index ads by keyword
④ High-level architecture
Ads Auction
Search query
Ad retrieval index
Auction ranker
Impression log → billing
⑤ Data flow & execution path
Per-query auction
Keyword match→Filter policy→Score = bid × quality→GSP pricing
Quality score from CTR history
Budget decrement async
⑥ API & interfaces
| Endpoint / flow | Purpose | Notes |
|---|---|---|
| POST /auction | Run auction | internal only |
| POST /campaigns | Advertiser CRUD | budget caps |
⑦ Data model & storage
Domain-specific entities sharded by user_id or geographic key.
| Store | What | Why |
|---|---|---|
| Distributed store | Primary data | Sharded for scale |
| Kafka / Pub/Sub | Event log | Async pipelines |
| Object store | Media / blobs | GCS-style durability |
⑧ Deep dive — core components
Generalized second price
Winner pays second-price + epsilon — incentivizes truthful bidding.
Budget pacing
Throttle impressions when spend rate exceeds daily budget curve.
⑨ Trade-offs & alternatives
| Decision | Option A | Option B | Pick when |
|---|---|---|---|
| Auction | GSP | VCG | GSP industry standard for search |
| Retrieval | Broad match | Exact | Broad more revenue; exact more relevance |
⑩ 45-minute interview script
- 0–5 min: Requirements + Google-scale assumptions
- 5–12 min: Back-of-envelope QPS and storage
- 12–22 min: Architecture diagram
- 22–35 min: Deep dive on hot path
- 35–42 min: Failure modes and trade-offs
⑪ Likely follow-up questions
| Question | Short answer |
|---|---|
| How roll out globally? | Regional cells + gradual feature rollout |
⑫ Revision checklist
- GSP explained
- Quality score
- Budget pacing
- Fraud filter
- Impression logging