🎬 Netflix System Design — Interview Class Notes
This transcript focuses mainly on three major flows:
Video Upload
Video Streaming
Video Search
The most important architectural idea is:
Separate the upload/processing pipeline from the streaming/read path, and use Object Storage + CDN to serve huge video files efficiently.
1. Problem Statement
Design a Netflix-like video streaming platform that supports:
Admin video upload
Video processing/transcoding
Thumbnail generation
Persistent video storage
Video streaming
Search
Metadata management
Global low-latency delivery
The key challenge is:
Large video files require expensive processing during upload, but millions of users need fast, reliable streaming afterward.
2. Three Core Assumptions ⭐
① Read-heavy or Write-heavy?
Extremely Read-heavy
Netflix has relatively few content uploads compared with the enormous number of video viewing requests.
Content creators/admins
↓
Uploads
↓
relatively few
Users
↓
Streaming
↓
millions/billionsTherefore:
Netflix is extremely read-heavy.
3. Distributed or Single Server?
Distributed system
We need:
Multiple API instances
Processing workers
Message queues
Object storage
CDN
Search infrastructure
Databases
Multiple geographic regions
Users
↓
Load Balancer
↓
Multiple Services
↓
Distributed Infrastructure4. Consistency or Availability?
⭐ Availability
For a streaming platform, availability is extremely important.
If:
Netflix unavailable
↓
User cannot watch
↓
Bad experienceSome metadata/search information can tolerate eventual consistency.
For example:
New movie uploaded
↓
Metadata indexed
↓
Search becomes available shortly laterThat's generally acceptable.
But:
The uploaded video itself must not be lost or corrupted.
So distinguish availability from durability/reliability.
5. Functional Requirements
Core Requirements
1. Video Upload
Admin should be able to upload:
Video
Metadata
User/admin ID
Admin
↓
Upload Service2. Video Processing
Uploaded video needs processing before streaming.
Examples:
Transcoding
Compression
Resolution conversion
Format conversion
Chunk processing
3. Thumbnail Generation
Generate thumbnails during processing.
Video
↓
Processing
↓
Thumbnail
↓
Object Storage4. Video Streaming ⭐⭐⭐
Users should be able to:
Search
↓
Select video
↓
Stream videoSupported clients could include:
Web
Mobile
Smart TV
Other streaming devices
5. Search
Users should be able to search by:
Title
Description
Genre
Other metadata
User
↓
Search Service
↓
Search Engine
↓
Results6. Non-Functional Requirements
① High Availability ⭐⭐⭐
Users expect the service to be available continuously.
② Low Latency
Video should start playing quickly.
Important metric:
Time to First Byte / Time to First Frame
The user shouldn't wait a long time after pressing Play.
③ Smooth Streaming ⭐⭐⭐
Once playback starts:
Video
████████████████████should continue without:
Video
███
⏸ Buffering
███
⏸④ Scalability
Must support:
Normal traffic
↓
Peak traffic
↓
Millions of concurrent viewers⑤ Reliability / Durability
Uploaded content must not disappear.
Need:
Replication
Durable object storage
Backup
Disaster recovery
7. High-Level Architecture ⭐⭐⭐
Start with this diagram.
ADMIN
│
▼
┌─────────────┐
│Load Balancer│
└──────┬──────┘
│
▼
Upload Service
│
▼
Message Queue
│
┌──────┴──────┐
▼ ▼
Worker 1 Worker 2
│ │
└──────┬──────┘
▼
Object Storage
│
┌─────────────┼─────────────┐
▼ ▼ ▼
Video Thumbnail MetadataThen streaming:
USER
│
▼
┌─────────────┐
│Load Balancer│
└──────┬──────┘
│
▼
Video Service
│
▼
CDN
│
▼
Object StorageAnd search:
USER
│
▼
Search Service
│
▼
Search Engine8. Video Upload Flow ⭐⭐⭐
Let's go step-by-step.
Step 1 — Admin Uploads Video
Admin
↓
Load Balancer
↓
Upload ServiceRequest contains:
video file
metadata
admin/user ID9. Why Load Balancer?
There may be multiple upload service instances.
Load Balancer
/ | \
/ | \
▼ ▼ ▼
Upload Upload Upload
Server Server ServerThis provides:
Horizontal scalability
Fault tolerance
Better throughput
10. The Important Design Decision — Where Does the Uploaded Data Go?
There are two approaches.
Option A — Object Storage First
Upload
↓
Object Storage
↓
ProcessingAdvantages:
Durable
Upload can resume
Processing can happen later
Better separation
Option B — Queue Chunks Directly
The transcript chooses this approach.
Upload Service
↓
50 MB chunks
↓
Message Queue
↓
Processing WorkersWhy?
Because the queue decouples:
Uploadfrom:
Processing11. Why 50 MB Chunks? ⭐
Large video files should not necessarily be processed as one giant request.
Split:
Video
↓
Chunk 1 = 50 MB
Chunk 2 = 50 MB
Chunk 3 = 50 MB
Chunk 4 = 50 MBThen:
Chunk 1 → Worker A
Chunk 2 → Worker B
Chunk 3 → Worker C
Chunk 4 → Worker DThis allows parallel processing.
12. Queue Provides Backpressure ⭐⭐⭐
Suppose:
Upload traffic
= 1,000 chunks/secbut processing capacity is:
500 chunks/secWithout a queue:
Workers overwhelmed ❌With a queue:
Upload
↓
Queue
↓
500 chunks/sec processedThe remaining chunks wait.
This is called:
Backpressure / workload buffering
13. Worker Service
Workers perform computationally expensive operations.
Queue
│
├── Worker 1
├── Worker 2
├── Worker 3
└── Worker 4Workers can scale horizontally.
High workload
↓
More workersThis is much better than making the Upload Service perform heavy processing synchronously.
14. Why Asynchronous Processing? ⭐⭐⭐
Bad architecture:
Admin
↓
Upload API
↓
Transcode video
↓
Generate thumbnail
↓
Store video
↓
ResponseThe request may take a very long time.
Better:
Admin
↓
Upload Service
↓
Queue
↓
Return acceptedThen:
Queue
↓
Workers
↓
Process asynchronouslyThis keeps the API responsive.
15. Processed Video → Object Storage
After processing:
Worker
↓
Processed Video
↓
Object StorageObject storage is ideal for huge binary files.
Examples conceptually:
videos/
├── movie123/
│ ├── chunk001
│ ├── chunk002
│ ├── chunk003
│ └── ...16. Thumbnail Generation
During processing:
Video Chunk
↓
Worker
├── Process Video
│
└── Generate ThumbnailThen:
Thumbnail
↓
Object StorageMetadata stores a reference:
video_id
thumbnail_url/reference17. Video Processing Pipeline ⭐
The complete pipeline:
ADMIN
│
▼
Upload Service
│
▼
Queue
│
┌───────────┼───────────┐
▼ ▼ ▼
Worker Worker Worker
│ │ │
└───────────┼───────────┘
▼
Processed Video
│
▼
Object Storage
│
┌───────────┴───────────┐
▼ ▼
Thumbnails Metadata18. Streaming Architecture ⭐⭐⭐⭐⭐
Now switch perspective.
We're no longer thinking about admins.
We're thinking about:
Millions of users watching videos.
User
↓
Video Service
↓
CDN
↓
Video Content19. Why CDN Is the Most Important Component? ⭐⭐⭐⭐⭐
Suppose the video is stored in:
US Data Centerand the user is in:
IndiaIf every video byte travels:
India → US → Indialatency and bandwidth costs increase.
Instead:
Origin
Object Storage
│
▼
CDN
/ | \
/ | \
▼ ▼ ▼
India Europe US
│
▼
UserThe CDN caches content geographically closer to users.
20. CDN Cache Flow
First request:
User
↓
CDN
↓
Cache MISS
↓
Object Storage
↓
CDN
↓
UserNext requests:
User
↓
CDN
↓
Cache HIT
↓
UserNo need to repeatedly access the origin.
21. Why This Is Critical for Netflix
Suppose:
Movie Xbecomes extremely popular.
Millions of users request it.
Without CDN:
Millions
↓
Object Storage
↓
🔥 Huge loadWith CDN:
Millions
↓
CDN Edge
↓
Cached MovieThis dramatically reduces origin load.
22. Streaming Chunks
Don't think of streaming as:
Download entire 10 GB movie
↓
Start watchingInstead:
Video
↓
Segments
↓
Segment 1
Segment 2
Segment 3
Segment 4
...The player downloads segments progressively.
This enables:
Faster startup
Seeking
Adaptive bitrate
Better failure recovery
23. Adaptive Bitrate Streaming ⭐⭐⭐
A strong extension to mention in an interview.
Create multiple versions:
Movie
├── 4K
├── 1080p
├── 720p
└── 480pClient chooses based on network conditions.
Example:
Good network
↓
1080p
Poor network
↓
480pThis prevents excessive buffering.
24. Search Architecture ⭐⭐⭐
The transcript introduces:
Search Service
↓
Search EngineFor example:
User
↓
Search Service
↓
Search Engine
↓
Results25. How Does Search Engine Get Data?
Important!
When video is uploaded:
Upload
↓
Processing
↓
Metadata
↓
Search IndexSo:
Video Metadata
↓
Search Indexer
↓
Search Engine26. Search Index Is a Derived Data Store
This is an important interview concept.
Your primary metadata DB might contain:
video_id
title
description
genre
release_date
thumbnailSearch engine contains a searchable representation.
Metadata DB
│
▼
Indexer
│
▼
Search EngineTherefore:
Search engine is generally not the source of truth.
27. Search Event Architecture
A scalable approach:
Upload / Metadata Service
│
▼
Kafka
│
▼
Search Indexer
│
▼
Search EngineThis avoids making upload dependent on synchronous search indexing.
28. Database Architecture
Possible storage:
Metadata
Metadata DBContains:
video_id
title
description
genre
thumbnail_reference
statusVideo
Object StorageSearch
Elasticsearch/OpenSearch-like engineProcessing
Message Queue / KafkaCDN
Edge Cache29. Video Processing State Machine
Very useful design.
UPLOADED
↓
PROCESSING
↓
PROCESSED
↓
AVAILABLEFailure:
PROCESSING
↓
FAILED
↓
RETRYThis prevents the system from accidentally serving incomplete videos.
30. Failure Handling ⭐⭐⭐
Suppose Worker 2 crashes.
Queue
↓
Worker 2 💥Message should become available for retry.
Queue
↓
Worker 3
↓
ProcessUse:
Retries
Exponential backoff
Dead-letter queue
Idempotent processing
31. Idempotency
Suppose:
Chunk 10
↓
Worker
↓
Processing successful
↓
Worker crashes before ACKQueue retries.
Now the same chunk gets processed again.
If processing isn't idempotent:
Duplicate output ❌Use a unique identifier:
video_id + chunk_id + processing_versionThen the worker can safely detect:
"This chunk has already been processed."
32. Upload Reliability
The transcript chooses:
Upload → QueueBut in a real interview, mention the alternative:
Object Storage First
Client
↓
Object Storage
↓
Queue/Event
↓
WorkersThis can be more robust for very large uploads because object storage provides durable persistence and can support resumable/multipart uploads.
Interview answer:
"Both are valid. For the simplified design I'll follow the transcript and put chunks into a durable queue, but for a production-scale implementation I'd strongly consider direct multipart upload to object storage followed by an event-driven processing pipeline."
That's a very good trade-off discussion.
33. Netflix Architecture — Complete ⭐⭐⭐⭐⭐
ADMIN
│
▼
Load Balancer
│
▼
Upload Service
│
▼
Message Queue
│
┌──────────────┼──────────────┐
▼ ▼ ▼
Worker Worker Worker
│ │ │
└──────────────┼──────────────┘
│
┌───────────┴───────────┐
▼ ▼
Video Storage Thumbnail Storage
│
▼
CDN / Origin
▲
│
Video Service
▲
│
│
USER
│
Web / Mobile / TV
Metadata Pipeline
│
▼
Metadata DB
│
▼
Kafka
│
▼
Search Indexer
│
▼
Search Engine
▲
│
Search Service
▲
│
USER34. Netflix vs Spotify ⭐
Since you've already studied Spotify, this comparison is useful.
| Concept | Spotify | Netflix |
|---|---|---|
| Media | Audio | Video |
| Workload | Read-heavy | Extremely read-heavy |
| Upload | Audio | Video |
| Processing | Audio processing | Heavy video transcoding |
| CDN | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Object Storage | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Search | Search engine | Search engine |
| Queue | Processing | Processing/transcoding |
| Main challenge | Audio streaming | Video streaming + transcoding |
| Adaptive bitrate | Important | Very important |
| Thumbnail | Album/artwork | Video thumbnails |
| Main bottleneck | Bandwidth | Bandwidth + processing |
35. Most Important Interview Deep Dive
If interviewer asks:
"What's the hardest part of Netflix?"
Answer:
Video processing + global video delivery
The pipeline is:
Upload
↓
Chunk
↓
Queue
↓
Workers
↓
Transcode
↓
Multiple resolutions
↓
Object Storage
↓
CDN
↓
Millions of Users36. 30-Second Interview Answer ⭐⭐⭐
"I would design Netflix as an extremely read-heavy distributed streaming system. For video ingestion, admins upload content through an Upload Service behind a load balancer. Large files are split into chunks and processed asynchronously through a durable queue, allowing multiple worker instances to perform computationally expensive transcoding and thumbnail generation in parallel. Processed video and thumbnails are stored in durable object storage. For playback, users access a Video Service, but the actual media delivery should happen primarily through a geographically distributed CDN to minimize latency and protect the origin from massive traffic. I'd store video metadata separately and index searchable fields asynchronously into a search engine. For reliability, I'd use replication, retries, idempotent processing and durable storage. For smooth playback, I'd support segmented adaptive-bitrate streaming with multiple resolutions."
🧠 37. Netflix — Memorize This Architecture
NETFLIX
│
┌───────────┼────────────┐
▼ ▼ ▼
Upload Process Search
│ │ │
▼ ▼ ▼
Queue Workers Search Engine
│
▼
Object Storage
│
▼
CDN
│
▼
Users🔥 One-line memory trick
Netflix = Upload → Queue → Transcode → Object Storage → CDN → Stream
And the four concepts you absolutely should know for an interview:
Async video processing
Object storage for large media
CDN for global streaming
Search index as a derived data store
Your four-system pattern is now becoming clear:
| System | Core interview problem |
|---|---|
| Spotify | Audio streaming |
| Amazon | Inventory + payment consistency |
| Real-time messaging + ordering | |
| Fan-out + timeline generation | |
| Netflix | Video processing + CDN streaming |
This is the right way to study these mock interviews: don't memorize every component—memorize the unique bottleneck and the architectural decision that solves it.
No comments:
Post a Comment