Skip to content

Case study: Ad click aggregation

Design a real-time ad click aggregation pipeline with event-time tumbling windows, watermarks for late clicks, and exactly-once billing.

35 min9 steps

By the end you can
  • Estimate peak click ingestion rate, deduplication state memory, and write reduction from 1-minute window rollups
  • Assign events to event-time tumbling windows and use watermarks and allowed lateness to handle delayed mobile clicks
  • Prevent double-billing on client retry or stream worker crash using impression deduplication and idempotent window upserts
  • Predict how the pipeline behaves when stream aggregators crash, a Super Bowl campaign spikes, or the OLAP store slows down

Separate user redirect latency from billing accuracy

Collect

  • Signed clicks; immediate browser redirect; dedup invalid clicks

Guarantees

  • No accepted click lost; exactly-once billing

Targets

  • Redirect p99 <50 ms; dashboards 10-30 s fresh; minute windows

Why shouldn't the click collector service update the advertiser's billing database synchronously before returning the 302 redirect?

Answer this step to continue.