Design a frequency capping system for an advertising platform.
The system must ensure that a user does not see the same advertisement more than a configured number of times within a given time window, such as:
-
at most 3 impressions per user per ad per day
-
at most 10 impressions per user per campaign per week
Your design should address:
-
how ad-serving systems check caps in real time before showing an ad
-
how impressions are counted and stored
-
how to support multiple cap scopes, such as user-ad, user-campaign, or household-level limits
-
how to handle high QPS, low latency, and eventual consistency across regions
-
what happens when counting data is delayed, duplicated, or arrives out of order
-
data retention, expiration of old counts, and operational trade-offs between accuracy and latency