RETURN TO SYSTEM DESIGN VAULT (55)BLUEPRINT #26 // Hard
#26HardMedia Streaming & Storage
Netflix: Limit the Number of Screens Each User Can Watch
ASKED IN INTERVIEWS AT:FAANGNetflix
EXECUTIVE SUMMARY & PROBLEM STATEMENT
Design a distributed concurrency control service that enforces per-subscription active video playback limits (e.g., maximum 2 or 4 concurrent screens) with sub-second heartbeats.
SCALE ESTIMATION & TRAFFIC ENVELOPE
DAILY ACTIVE USERS / TPS200 Million subscribers, 20 Million concurrent playing devices
READ / WRITE TRAFFIC RATIOHeartbeat write every 10 seconds per active stream
5-YEAR STORAGE CAPACITYRedis In-Memory Key Sets: ~20M active leases = ~2 GB RAM
FUNCTIONAL REQUIREMENTS
- [1]Verify user has not exceeded plan's concurrent screen limit on play
- [2]Heartbeat playback every 10 seconds
- [3]Terminate oldest session or reject new play on overflow
NON-FUNCTIONAL REQUIREMENTS
- •Sub-50ms latency on play request
- •Graceful recovery if player app crashes (fast lease expiry)
- •Resilient to network blips
CORE ARCHITECTURAL COMPONENTS
Playback Authorization Service
Heartbeat Collector
Redis Cluster Lease Store
Device Session Eviction Worker
DATA SCHEMA & PERSISTENCE
Redis Key: `user_streams:{account_id}` -> Set of `{ device_id, session_id, last_heartbeat }`
DISTRIBUTED TRADE-OFFS & FAILURE MODES
- ⟡15-second TTL on heartbeats handles sudden client disconnects cleanly without locking out legitimate users on other TVs.