Design Rolling-Window Ad Frequency Capping
NetflixSoftware Engineer · OnsiteLast updated
This question evaluates system-design skills for building scalable, low-latency services that enforce time-based rolling-window state, including data modeling for impression history, read/write paths, concurrency control, and fault tolerance; category: System Design.
Design a frequency-capping service for an advertising platform.
The ad platform receives ad requests for users and must decide whether a candidate ad, ad group, or campaign can be shown. Each cap has the form: a user may receive at most N impressions for a given ad scope during the last W units of time. The window is rolling, not calendar-based.
Your design should cover:
- the read path used when deciding whether to show an ad,
- the write path used after an ad impression is served,
- data models for cap definitions and impression history,
- how to enforce caps correctly under high request volume,
- how to handle distributed-system issues such as race conditions, duplicate requests, failures, and data retention.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.