28. Aggregate events that arrive late or twice
Keep tenant usage totals correct across duplicate delivery, late events, outages and replay.
Start with a template. Work through each step. Ask Coach when you need a second opinion.
Company tags are community-reported. Counts on cards show how many people reported that design.
Keep tenant usage totals correct across duplicate delivery, late events, outages and replay.
Count every ad click once, fast enough to chart live and exactly enough to bill. One-hour interview boards for junior, senior and staff: requirements, data layer, low-level design and what goes wrong at every component.
The classes and code behind the ad click aggregator: signed click tokens, a redirect that never waits on the log, and a stream counter that de-duplicates and handles late clicks. Tests run all of it.
The K most-viewed videos for the last hour, day, month and all time from 700,000 views a second, exactly and in milliseconds.
A partitioned, replicated append-only log: a million messages a second, order per key, nothing acknowledged ever lost, a week of replayable history.
A stateful stream processor: dataflow graphs, keyed state in RocksDB, event time and watermarks, windows, barrier checkpoints, exactly-once into Kafka.
Every committed change in Aurora and DynamoDB, read from the log and delivered in order per row to search, caches, Redshift and an S3 lake.
Count 4 million moving drivers per map cell from a million pings a second, and serve the density to a million viewers as cached map tiles.