Bird
Raised Fist0

Netflix - Personalization, Adaptive Streaming, Global CDN Architecture

HLDhardInterview freq: high
Choose your preparation mode4 modes available
▶
Request Trace
Step 1/7
Global DNS Load Balancer

Routes user HTTPS request to nearest Personalization API endpoint

User's video request is routed to closest regional API server

Protocol:HTTPS
BeforeUser Device initiated video request to netflix.com
AfterRequest resolved to nearest Personalization API instance
Personalization API

Queries User Profile DB for user preferences

Fetches user viewing history and preferences to personalize stream

Protocol:CQL Query
BeforePersonalization API received user request without user context
AfterUser preferences retrieved from Cassandra for manifest generation
User Profile DB (Cassandra)

Returns user profile data to API Layer

Serves low-latency read of user preferences and watch history

Protocol:CQL Response
BeforeUser profile data stored in Cassandra
AfterUser profile data delivered to Personalization API
Kafka Cluster

Receives user activity event from API Layer

Streams user playback start event for analytics processing

Protocol:Kafka Produce
BeforeUser started playback, event not yet recorded
AfterPlayback event durably stored in Kafka topic
Analytics DB (ClickHouse)

Consumes batch of events from Kafka for aggregation

Aggregates user activity metrics for personalization tuning

Protocol:Batch Insert
BeforeKafka topic contains unprocessed user events
AfterAnalytics DB updated with latest user activity metrics
CDN Edge Servers

Serves adaptive bitrate video chunks to user

Delivers video segments optimized for current network conditions

Protocol:HTTPS GET
BeforeUser Device requests video chunks
AfterVideo chunks delivered with adaptive quality
Origin Storage (S3 + HDFS)

Serves video chunks cache-miss to CDN Edge

Provides master video files when CDN cache misses occur

Protocol:HTTPS GET
BeforeCDN Edge cache miss for requested video chunk
AfterVideo chunk retrieved from origin storage and cached at CDN
🏗️
Architecture Diagram
Architecture Diagram
┌───────────────┐
│  User Device  │
└───────┬───────┘
        │ HTTPS Request (video request)
        ▼
┌───────────────────────────────┐
│ Global DNS Load Balancer       │
│ (routes to nearest region)     │
└───────────────┬───────────────┘
                │ HTTPS Request
                ▼
┌───────────────────────────────┐
│ Personalization API            │
│ (fetches user prefs & session)│
└───────────────┬───────────────┘
                │ CQL Query
                ▼
┌───────────────────────────────┐
│ User Profile DB (Cassandra)   │
│ (stores user preferences)     │
└───────────────┬───────────────┘
                │ Kafka Event (user activity)
                ▼
┌───────────────────────────────┐
│ Kafka Cluster                 │
│ (event streaming platform)    │
└───────────────┬───────────────┘
                │ Batch Insert
                ▼
┌───────────────────────────────┐
│ Analytics DB (ClickHouse)      │
│ (stores aggregated metrics)   │
└───────────────┬───────────────┘
                │ HTTPS Redirect
                ▼
┌───────────────────────────────┐
│ CDN Edge Servers               │
│ (serve adaptive video chunks) │
└───────────────┬───────────────┘
                │ HTTPS GET (video chunks)
                ▼
┌───────────────────────────────┐
│ Origin Storage (S3 + HDFS)     │
│ (stores master video files)    │
└───────────────────────────────┘

This architecture illustrates Netflix's global video streaming pipeline with personalization and adaptive bitrate delivery. The user request first hits the Global DNS Load Balancer, which routes it to the nearest Personalization API. This API queries the User Profile DB (Cassandra) to fetch user preferences for personalized manifests. User playback events are streamed into Kafka for real-time analytics ingestion. The Analytics DB (ClickHouse) aggregates these events to refine personalization models. Video content is served via CDN Edge Servers that deliver adaptive bitrate chunks based on network conditions, fetching from Origin Storage (S3 + HDFS) on cache misses. This design balances low latency, personalization, and global scale.

Primary Focus

✓

Practice

(1/5)
1. In the alerting system's request flow, at Step 4 the Composite Alert Processor receives individual alerts from Threshold and Anomaly detectors. What does it do when one of the input alerts is delayed beyond its TTL?
easy
A. It immediately triggers the composite alert ignoring the delayed input
B. It discards all alerts and resets the composite alert state
C. It waits indefinitely for the delayed alert before evaluating the composite condition
D. It marks the delayed alert as stale and evaluates the composite alert with available inputs

Solution

  1. Step 1: Understand Composite Alert Processor behavior

    The processor combines multiple alerts but must handle delayed inputs gracefully to avoid blocking.
  2. Step 2: TTL handling

    When an input alert exceeds its TTL, it is considered stale; the processor evaluates the composite alert with the alerts it has rather than waiting indefinitely.
  3. Final Answer:

    Option D -> Option D
  4. Quick Check:

    Composite alert evaluates with stale inputs marked, not blocking indefinitely [check]
Hint: Delayed alert -> mark stale, evaluate with available inputs [check]
Common Mistakes:
2. A notification system must handle 1 million notification writes per second and fan out to millions of devices asynchronously. Which component best decouples the write load from delivery workers to ensure durability and scalability?
easy
A. Use a simple HTTP REST API to synchronously send notifications to all devices
B. Use a relational database with sharded tables to store notifications and poll for delivery
C. Use an in-memory cache like Redis to store notifications and push directly to devices
D. Use a distributed message queue like Kafka partitioned by user ID for ordered, durable fan-out

Solution

  1. Step 1: Identify the role of the message queue

    Kafka provides durable, partitioned logs that decouple producers from consumers, enabling high write throughput and ordered delivery per user.
  2. Step 2: Evaluate other options

    Relational DB polling (A) can't handle 1M writes/sec efficiently; Redis (C) lacks durability and persistence guarantees; synchronous HTTP (D) blocks on delivery and doesn't scale.
  3. Final Answer:

    Option D -> Option D
  4. Quick Check:

    Kafka partitions by user ID -> durable, ordered fan-out [check]
Hint: Kafka partitions decouple writes from delivery at scale [check]
Common Mistakes:
3. Without the message queue (Kafka) in the architecture, what exactly breaks when Alice sends a message to Bob during a partial regional outage?
medium
A. Messages are buffered locally on Alice's client until Bob reconnects
B. Alice's message is immediately delivered but Bob's client shows duplicate messages
C. Alice's send blocks waiting for Bob's server response; if Bob's server crashes, the message is lost with no retry
D. The system automatically retries sending messages indefinitely without blocking

Solution

  1. Step 1: Understand Kafka's role in decoupling

    Kafka buffers messages asynchronously, preventing blocking and enabling retries during outages.
  2. Step 2: Analyze failure without Kafka

    Without Kafka, synchronous calls block sender until receiver responds; if receiver crashes, message is lost with no retry (B). However, buffering on client (C) is incorrect as buffering is server-side.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    No Kafka -> synchronous send blocks and message loss on receiver crash [check]
Hint: No Kafka -> send blocks, no retry, message lost on crash [check]
Common Mistakes:
4. If the global BGP route monitoring system is disabled during a misconfiguration event, what is the most likely failure observed in the network recovery process?
medium
A. Routers automatically revert to default static routes, causing traffic blackholing
B. Network devices silently drop BGP updates, leading to partial route visibility
C. Operators receive delayed alerts, causing prolonged outage and inconsistent routing states
D. Clients experience immediate failover to backup ISPs without disruption

Solution

  1. Step 1: Role of BGP monitoring

    BGP monitoring detects anomalies and route changes; without it, routers may silently drop updates due to misconfigurations.
  2. Step 2: Eliminate other options

    Delayed alerts (A) affect operators but don't cause silent drops; routers don't revert to static routes automatically (B); immediate client failover (D) unlikely without proper routing.
  3. Final Answer:

    Option B -> Option B
  4. Quick Check:

    Without monitoring, routers drop BGP updates silently causing partial visibility [check]
Hint: No monitoring -> silent BGP update drops, partial routes [check]
Common Mistakes:
5. At 10x scale, which component of a distributed token bucket rate limiter is most likely to fail first and why?
hard
A. The distributed cache storing token counts, because it cannot handle the increased read/write throughput
B. The centralized token refill scheduler, because it becomes a single point of contention and latency bottleneck
C. The client-side token bucket implementation, because local memory limits token storage capacity
D. The network between API gateways and the token store, because increased traffic causes packet loss and delays

Solution

  1. Step 1: Identify centralized token refill scheduler role

    It coordinates token replenishment globally, requiring strong consistency and frequent updates.
  2. Step 2: Analyze scaling impact

    At 10x scale, centralized scheduler becomes a contention bottleneck and latency hotspot, limiting throughput.
  3. Step 3: Compare other components

    Distributed cache scales better with sharding; client-side buckets are local and scale naturally; network issues are secondary to scheduler bottleneck.
  4. Final Answer:

    Option B -> Option B
  5. Quick Check:

    Centralized scheduler bottlenecks first at scale [check]
Hint: Centralized scheduler bottlenecks first at scale [check]
Common Mistakes:
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard