← Questions

Design an ad marketplace between publishers and advertisers

0
DatabricksOpenAISystem designLast asked Nov 2025

A system design interview question asked in Databricks's system design round and at OpenAI, last asked Nov 2025. It tests ads, auctions and low latency.

Design an ad marketplace. Publishers' web pages and apps request an ad each time a slot is shown, and advertisers bid to fill those slots. The marketplace runs an auction for each request within a tight latency budget, serves the winning ad, and tracks spending so that no advertiser goes over their budget.

Requirements

  • Functional: advertisers create campaigns with targeting (location, device, topic), bids and daily budgets; publishers register ad slots; for each ad request, find eligible campaigns, run an auction, and return the winning ad; record impressions and clicks; charge advertisers and pay publishers; stop serving a campaign when its budget runs out.
  • Non-functional: the auction answers within tens of milliseconds at very high request rates; spending never exceeds a budget by more than a small, known amount; impression and click records are accurate enough to bill on.

Clarifying questions

  • What is the scale: requests per second, number of campaigns?
  • Are advertisers charged per impression, per click, or both?
  • What auction: first price or second price? Is there a reserve price per slot?
  • Do external bidders take part (real-time bidding), or only campaigns stored with us?
  • How strict is the budget: never over, or over by at most a few percent?

What a strong answer covers

  • The request path: ad request, targeting lookup from an in-memory index of active campaigns, scoring (bid times predicted click rate for per-click campaigns), auction, response with a tracking URL, all within the latency budget.
  • Keeping campaign and targeting data in memory on ad servers, refreshed from the source of truth by a change stream.
  • Budget control: a central budget service is too slow per request, so allocate budget slices to servers, decrement locally, and pace spending through the day; the overspend this allows and how it is bounded.
  • Event pipeline for impressions and clicks: durable logs, deduplication, fraud filtering, then aggregation for billing and for updating spend.
  • Second-price auction mechanics and why it encourages truthful bids; reserve prices.
  • Failure handling: an ad server losing its budget slice, a delayed event pipeline, and defaulting to no ad rather than overspending.

Follow-ups

  • Add external bidders with a 100 ms timeout. How does the auction change?
  • An advertiser with a $100 daily budget gets a sudden traffic spike. Walk through how you avoid overspending.
  • How do you detect and filter fake clicks?

Where it's asked

  • Databricks · System design · Last asked Nov 202560 min · Design discussion, often written in a Google Doc rather than on a whiteboard
  • OpenAI · Technical screen: coding · Last asked Sep 202560 min · One problem in three to five growing parts filling the hour, usually in CoderPad; ML roles get a Colab notebook with autocomplete off · No AI assistants or autocomplete; documentation is fine

What it tests

ads · auctions · low latency

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing