Design an Ad Delivery System

Quick Overview

Design a personalized ad serving system. Cover ad selection and auction mechanics, real-time bidding, targeting based on user signals, frequency capping, and serving latency requirements under 100ms.

Meta
System Design
Software Engineer
Meta
Software Engineer
Onsite
System Design
Hard

0


Design a personalized ad serving system. Cover ad selection and auction mechanics, real-time bidding, targeting based on user signals, frequency capping, and serving latency requirements under 100ms.

Ads are Meta's core business, and onsite designs here test whether you can run a low-latency auction across billions of users. The interviewer checks the funnel from targeting and retrieval to ranking and auction, how frequency caps and budgets are enforced in real time, and how everything fits within about 100ms.

What the Interviewer Expects
  • Lay out the serving funnel: targeting filter, candidate retrieval, ranking, auction
  • Explain the auction and ranking score, for example bid times predicted action rate plus quality
  • Enforce frequency caps and budget pacing with fast counters
  • Budget latency per stage to stay under 100ms
  • Log impressions and clicks reliably for billing and model training
  • Discuss privacy constraints on user signals
Key Topics to Cover
Ad auctions
Candidate retrieval and ranking
Frequency capping
Budget pacing
Low-latency serving
Event logging
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How would you keep an advertiser from overspending its daily budget across many data centers?
  • How would you implement a frequency cap of three impressions per user per day?
  • What happens if the prediction model is slow or unavailable?
  • How would you handle a new ad with no click history?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Functional Requirements:
    • Ad Selection: The system must select relevant ads based on user profiles, interests, and behavior.
    • Auction Mechanics: Implement a real-time bidding a...
Capacity Estimation
  • User Base: Assume Meta has approximately 2 billion active users.
  • Ad Requests: If each user generates an average of 10 ad requests per day, that equals 20 billion requests daily, or appro...

Submit Your Answer
Markdown supported