Ad Click Aggregator
Count a firehose of clicks in real time — and lose none of them.
Ingest a firehose of ad clicks and aggregate them in near-real-time — losing none as a viral ad lands and aggregators fail.
Buffer the click firehose in a durable event stream, then aggregate with windowed stream-processing workers into an OLAP store. The stream is your shock absorber and your replay log.
Components in play
- Ingest API — Accepts and validates click events.
- Event stream — Durable Kafka-style log — buffers and replays.
- Aggregators — Windowed stream processors that roll up counts.
- OLAP store — Columnar store for aggregated analytics.
Graded on these SLOs
- ≥ 98.00%No clicks lost
- ≥ 25k rpsIngest rate
- ≤ 90%Headroom
- ≤ 14Lean fleet
The brief
Design the pipeline behind 'how many clicks did this ad get': ingest a firehose of click events, aggregate them by ad / campaign in near-real-time, and serve dashboards — accurately, even when a viral ad 10×'s the volume and aggregators crash.
Functional
- Ingest click events at scale
- Aggregate counts by ad / campaign / time window
- Serve near-real-time + historical queries
Non-functional
- No lost events (billing depends on it)
- Absorb sudden 10× spikes
- Exactly-once aggregation
Read the deep dive
15 min readAn ad click aggregator answers a deceptively simple question — 'how many clicks did this ad get?' — for a firehose of events, in near-real-time, and with the accuracy that billing depends on. The hard part is not the counting; it is doing it without losing a single event when a campaign launches, a viral ad multiplies the volume, and the machines doing the aggregation fall over mid-stream. The whole design is an exercise in decoupling ingestion from processing so that failures and spikes are absorbed by a durable buffer instead of dropped on the floor.
Warm-up: design decisions
Optional theory to prime the calls a senior engineer would make before you build.
Solving is a Pro feature
Unlock the on-canvas AI design coach, per-run design reviews, the chaos simulator and all 12 problems for $15/month.
- AI design coach on your canvas — pins failure points & over-engineering
- Honest AI design review on every run
- All 12 problems + unlimited chaos simulator
- Points, levels & leaderboard