Ad Click Aggregator: The Big-Game Commercial
Hard · system design problem
A commercial airs to 100 million viewers: clicks ×6 for the rest of the hour, and then every advertiser opens the live dashboard at once. Two consumer groups, one shard limit, one analytical database.
Ad clicks (20,000/s) are written to Kinesis (32 shards, ~1,000 records/s each). Two consumer groups read every click: the click-aggregator rolls them up per campaign and minute into ClickHouse (one row per ~100 clicks), and the archiver batches raw clicks into S3 for billing audits. Advertisers watch live campaign reports, which query ClickHouse; reports are the same for everyone watching a campaign and fine to cache for a few seconds. At T+20s the commercial airs: clicks ×6 for the rest of the hour. Budget pacing reads the aggregates, so they must be at most 30 seconds behind.
Topics
More
Codelays runs in your browser: turn on JavaScript to use it.