← Netflix Interview Insights

Netflix·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
Jun 2026

Summary

Netflix system design round, one big question that sprawled into like six sub-topics. They clearly wanted to see how deep you could go on a distributed counter problem, not just sketch boxes on a whiteboard.

Questions Asked (1)

Q1

Design a system that enforces ad frequency caps, where each user-campaign pair must not exceed a configured number of impressions within rolling time windows (e.g., 3 per day, 10 per week, 20 per month). The read path needs to return allowed or blocked with single-digit millisecond latency before each ad serve, and the write path increments counters when an impression is actually rendered. Cover counter store options, key design, windowing strategies, hot-key mitigation, write idempotency, offline reconciliation, and graceful degradation.

System DesignTechnical Trade-offsData Modeling
Author's notes

This one kept branching.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then propose a low-latency read path using an in-memory counter store with precomputed rolling windows. Discuss the write path with idempotent increments, hot-key mitigation, and offline reconciliation for accuracy. Finally, cover graceful degradation and trade-offs between consistency and availability.

Pro tip: Emphasize that the read path must be fast and approximate, while the write path ensures eventual accuracy; this separation of concerns is key to meeting latency and correctness goals.

1. Clarify Requirements and Scale

Ask about expected QPS, latency targets, consistency requirements, and whether caps are per user-campaign or global. Understand the read/write ratio and data volume.

2. Design the Read Path

Propose an in-memory store (e.g., Redis) with keys like user:campaign:window and precomputed counts. Use rolling windows via bucketed time slots (e.g., hourly) and sum relevant buckets for day/week/month checks.

3. Design the Write Path

Increment counters asynchronously after impression render. Ensure idempotency using unique impression IDs and deduplication. Use a message queue for reliability and to decouple from ad serving.

4. Address Hot Keys and Scalability

Mitigate hot keys via sharding (e.g., user_id % N) or local caching with periodic sync. Consider using a distributed cache with replication and consistent hashing.

5. Handle Failures and Reconciliation

Implement graceful degradation: if counter store is unavailable, allow ads (fail-open) or block (fail-closed) based on business needs. Run offline reconciliation from logs to correct counts and handle discrepancies.

Key Points to Mention

  • Counter store options: Redis, Memcached, or custom in-memory with persistence; trade-offs in latency, durability, and cost.
  • Key design: composite keys like {user_id}:{campaign_id}:{window_type}:{bucket} to enable efficient lookups and updates.
  • Windowing strategies: sliding window vs. bucketed (tumbling) windows; bucketed simplifies computation but may have edge inaccuracies.
  • Hot-key mitigation: sharding, local caching, or using a write-behind cache to reduce load on a single key.
  • Write idempotency: use unique impression IDs and deduplication in the write path to avoid double-counting.
  • Offline reconciliation: batch process logs to recompute counts and correct the online store, ensuring eventual consistency.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.