Design an Ad Impression Pipeline With Billing-Grade Counts
Last updated: November 29, 2026
Quick Overview
Design the pipeline that ingests ad impression and quartile beacons from millions of streaming devices, deduplicates them, detects invalid traffic, and produces impression counts that advertisers are billed on, both in near real time and as a final daily figure.
Roku
November 29, 20260
0
0 solved
Design the pipeline that ingests ad impression and quartile beacons from millions of streaming devices, deduplicates them, detects invalid traffic, and produces impression counts that advertisers are billed on, both in near real time and as a final daily figure.
Roku's advertising engineering team processes ad impressions at very large scale, and billing, pacing and forecasting all depend on these counts. A hard system design round here checks exactly-once semantics in practice, late and duplicate data, and reconciling a fast path with an authoritative path.
What the Interviewer Expects
- Defines event schema with a stable impression id and quartile events
- Uses a durable log (Kafka-style) partitioned to keep per-impression ordering
- Deduplicates by impression id with bounded state and idempotent sinks
- Separates real-time pacing counts from final billing counts with reconciliation
- Covers invalid traffic filtering, late data and replay from raw storage
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How long must the dedup window be, and what does a device retrying after a day do to it?
- How would you serve advertiser dashboards that slice counts by many dimensions?
- How do you prove to an advertiser that a count is correct?
- What changes for server-side ad insertion where the server, not the device, sends beacons?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: ingest start and quartile beacons (start, 25, 50, 75, complete) plus click/interaction; dedupe; filter invalid traffic; aggregate by campaign, line item, creative, publisher app, geo and h...
High-Level Design
- Edge collectors: stateless HTTPS endpoints behind load balancers, validate and append to a log partitioned by
impression_id. Return 200 only after the append is acknowledged. - Raw archive: every ...