Design an Ad Event Measurement Platform
Design a reliable event-time pipeline that ingests ad events and serves reproducible per-ad and campaign analytics despite duplicates, late data, and replay.
Problem statement
For this exercise, assume client and server producers submit impression, click, and conversion events. Every event carries a unique event ID, event time, received time, account, campaign, and ad IDs (each ad belongs to one campaign), event type, and schema version; a logical event must count at most once.
Advertisers query the count of clicks, impressions, or conversions for a particular ad by event type and time window, along with campaign roll-ups, and can inspect freshness and data-quality status.
Aggregates remain reproducible from accepted event versions, late events may revise prior windows for seven days, and correction or replay runs must not double-count events.
Ad serving, auction selection, billing, identity-graph construction, and machine-learning attribution are outside scope; conversion events arrive with the ad and campaign identity that should be measured.
What to build
- Authorized producers can submit bounded event batches and receive accepted, duplicate, invalid, or retryable outcomes for each event.
- Advertisers can query impression, click, and conversion counts for a particular ad, plus campaign roll-ups, by time range with an explicit event-time watermark and revision state.
- Platform owners can publish immutable event-schema versions and quarantine incompatible records without silently accepting malformed measurements.
- Authorized operators can replay or correct bounded accepted-event ranges and produce reproducible aggregate revisions without double counting logical events.
At scale
- For this exercise, assume peak ingestion of 500,000 events per second with an average encoded event size of 800 bytes.
- For this exercise, target 99.99% ingestion availability and make 99% of accepted events visible in ad and campaign aggregates within five minutes.
- For this exercise, accept valid events up to seven days late, retain immutable raw accepted events for 30 days, and retain aggregate revisions for 13 months.
- For this exercise, assume common dashboard queries cover one ad or one campaign over the latest 30 days and should complete within two seconds at p95.