System Design Architectures

Interactive technical blueprints, capacity estimates, database sharding strategies, and visual flowcharts for the top 30 system design interview questions.

Target Architectures
Architecture Blueprint

Design Netflix

Resilient video catalog search, user playback markers, and edge-colocated media CDN.

1. System Requirements

Functional
  • Browse and search movies and TV shows.
  • Stream high-definition media files with minimal buffering.
  • Track and resume playback progress across multiple devices.
  • Generate personalized recommendations.
Non-Functional / SLA
  • Highly resilient catalog viewing (99.999% SLA).
  • High scalability for global read queries.
  • Optimal CDN performance at the ISP level.

2. Scale & Resource Estimates

Throughput: 200 Million subscribers. 1 Billion streaming hours per week. Peak stream = 20 Million active concurrent connections.

Storage & RAM: Master catalog contains 10,000+ shows, replicated globally across ISP caches.

3. System API Endpoints

// 1. Fetch catalog recommendations
GET /api/v1/catalog/browse?genre=scifi
Response: { media: [ { show_id: "shw-551", title: "Interstellar", media_url: "..." } ] }

// 2. Save active playback progress marker
POST /api/v1/playback/marker
Request: { show_id: "shw-551", user_id: "usr-441", offset_seconds: 3652 }
Response: { status: "saved" }

4. Database Schema Design

Table: user_progress (Cassandra - sharded by user_id)
- user_id (UUID - Partition Key)
- show_id (UUID - Clustering Key)
- offset_seconds (INTEGER)
- last_watched_at (TIMESTAMP)

Table: catalog_cache (Elasticsearch Index)
- show_id (Keyword)
- title (Text)
- cast (Text)
- tags (Keyword array)

5. Interactive High-Level Architecture

graph TD Client[Viewer App] -->|Query Catalog| Gateway[Zuul API Gateway] Gateway -->|Search| Search[Elasticsearch Search Service] Gateway -->|Retrieve Progress| Progress[Playback State Service] Progress -->|Read/Write| ProgressDB[(Cassandra DB)] Client -->|Stream Movie| OpenConnect[(Netflix Open Connect CDN)] OpenConnect -->|Deliver segment| Client

6. Scalability Deep Dive & Bottlenecks

Leverages a custom CDN infrastructure called Open Connect. Netflix ships physical storage appliances (Open Connect Boxes) pre-loaded with video catalogs directly to local Internet Service Providers (ISPs). This allows video data to bypass standard internet exchange points, streaming files directly to users from their local ISP server rack. Playback markers are synced to Cassandra for sub-millisecond writes.

7. Production Scaling Strategies

Open Connect Appliances: Deploy 17K+ OCA servers in 1000+ ISP locations globally. Each OCA holds 100-200 TB of pre-positioned content. Nightly, a content placement algorithm decides which titles to cache on each OCA based on regional viewing patterns.

Encoding Matrix: Each title is encoded into 1200+ streams (resolution × bitrate × codec × audio track). H.264 for legacy, AV1 for bandwidth savings (30% smaller). Per-shot adaptive encoding optimizes quality per-scene (action scenes get higher bitrate, dialogue gets lower).

Microservice Architecture: 1000+ microservices on AWS. API gateway routes to services via Zuul. Circuit breakers (Hystrix) prevent cascading failures. Each service scales independently — the recommendation service scales to 100K+ instances during peak hours.

Playback State Sync: Resume position, audio track, and subtitle preferences stored in Cassandra (key: user_id + title_id). Writes on every 10-second interval during playback. At 200M subscribers × 2 concurrent streams = 40M writes/sec during peak. Cassandra handles this via token-ring partitioning.

Recommendation Pipeline: Batch compute (Spark) generates candidate sets nightly. Real-time personalization (online model) re-ranks candidates per user session. A/B testing framework runs 100+ simultaneous experiments on recommendation algorithms.

Chaos Engineering: Netflix pioneered Chaos Monkey — randomly terminates production instances to ensure services handle failures gracefully. Chaos Kong simulates entire region failures. This ensures the system survives any single component outage.

8. Runnable Production Starter Code

Scaffold