← Netflix Interview Insights

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

SeniorPrefer not to say
Jun 2026Remote

Summary

Netflix system design round, one big question that took up the whole session. The problem was designing a real-time ad frequency capping system and it went way deeper than I expected, covering everything from rolling window counters to multi-region consistency tradeoffs.

Questions Asked (1)

Q1

Design a real-time ad frequency capping system that enforces rolling-window impression limits per user across multiple dimensions (campaign, advertiser, creative) and multiple simultaneous time windows, with a check-and-reserve API and an impression logging API.

System DesignTechnical Trade-offsData Modeling
Author's notes

This one is massive.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: scale (QPS, number of users, campaigns), latency constraints, consistency needs, and failure modes. Then design a distributed system using a fast in-memory store (e.g., Redis) with atomic check-and-reserve operations, and a durable log (e.g., Kafka) for impression events. Discuss trade-offs between accuracy, latency, and cost, and how to handle multi-dimensional and multi-window limits efficiently.

Pro tip: Emphasize idempotency and atomicity: use unique impression IDs and Lua scripts or transactions in Redis to ensure check-and-reserve is atomic and exactly-once. Also, consider pre-aggregating counts and using approximate algorithms (e.g., sliding window counters) to reduce memory and latency at scale.

1. Clarify Requirements and Constraints

Ask about scale (DAU, QPS, number of campaigns/advertisers/creatives), latency SLA (e.g., <10ms), consistency requirements (strong vs eventual), and failure tolerance. Determine if limits are hard or soft, and how to handle over-delivery.

2. Design Data Model and Storage

Model counters per user per dimension per window (e.g., user:123:campaign:456:1h). Use a fast in-memory store like Redis with TTL for window expiration. Consider sharding by user ID for scalability and using sorted sets or time-bucketed counters for rolling windows.

3. Implement Check-and-Reserve API

Design an atomic operation that checks all applicable limits and reserves an impression if allowed. Use Redis Lua scripts or transactions to ensure atomicity across multiple counters. Return a reservation token to be used in logging.

4. Implement Impression Logging API

Log actual impressions asynchronously via a durable queue (e.g., Kafka) to update counters and for billing/analytics. Ensure idempotency using the reservation token to avoid double-counting. Handle failures with retries and dead-letter queues.

5. Address Scalability, Consistency, and Failure Modes

Discuss sharding, replication, and fallback strategies (e.g., local caching, degraded mode). Explain how to handle race conditions, hot keys, and data loss. Consider trade-offs between strong consistency and availability.

Key Points to Mention

  • Atomic check-and-reserve using Redis Lua scripts or transactions to prevent race conditions.
  • Efficient rolling window implementation using time-bucketed counters or sorted sets with TTL.
  • Multi-dimensional and multi-window limits: how to check all limits in one atomic operation.
  • Idempotency and exactly-once semantics using unique impression IDs and reservation tokens.
  • Scalability: sharding by user ID, using a distributed cache, and handling hot keys.
  • Trade-offs: latency vs consistency, memory vs accuracy (e.g., approximate counting), and cost.

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