This question evaluates a candidate's ability to design scalable, low-latency distributed systems that enforce ad frequency caps across users, devices, and profiles, testing competencies in system architecture, data modeling, consistency, and real-time enforcement; it falls under the System Design domain and requires both high-level architectural understanding and practical application-level trade-off reasoning. It is commonly asked to assess how applicants reason about scalability, availability, latency-consistency trade-offs, API and data flow design, and failure modes when enforcing multi-window caps at high QPS.
You are designing an ad-serving platform (e.g., for a streaming service with ads). The product requires frequency capping so that a user does not see the same ad/campaign too many times.
(user_id, device_id, profile_id?, placement, timestamp, candidate_ads)
, return an ad that
respects frequency caps
.
N impressions per 24 hours
M impressions per 7 days
K impressions per session