Problem statement
Design the service that remembers where every viewer is in every title so they can resume playback and see a personalized 'Continue Watching' row across all their devices. Players stream a constant flow of progress heartbeats; the service must absorb that write load and still serve a fast, consistent resume position.
Operating context. During playback each player sends periodic heartbeats carrying the title, current position, timestamp, and device. A viewer might pause on a phone and resume on a TV minutes later and expect the right position. The home page reads a 'Continue Watching' list that excludes finished and dismissed titles. Write volume is enormous and heavily skewed to evenings; reads must stay fast; and heartbeat writes can be best-effort while the resume read must be reliable.
Out of scope. Recommendation ranking of other rows, the actual video delivery, the analytics/BI warehouse fed from these events, and parental-control profiles. Assume separate teams own those.
What to produce. A high-level architecture covering: the high-volume heartbeat write path, the data model and partitioning, cross-device reconciliation of the resume position, the 'Continue Watching' read and its ordering, completion detection, retention and archival, and graceful degradation of writes under load. Sketch the components and the request flow; we will probe specifics during checkpoints.
Functional requirements
- Record playback-progress heartbeats (title, position, timestamp, device) during playback.
- Return the last-known resume position for a user and title at playback start, reconciled across devices.
- Produce an ordered 'Continue Watching' list for a user, excluding completed and dismissed titles.
- Mark a title complete when playback passes a credits/threshold point, removing it from the resume list.
- Let a user remove a title from their 'Continue Watching' list.
Non-functional requirements
- Ingest 1,000,000 heartbeat writes/sec at global peak.
- 'Continue Watching' read p99 under 80 ms.
- Resume position is consistent across a user's devices within 5 seconds of a heartbeat.
- Store history for 300,000,000 users across a 100,000-title catalog.
- 99.95% availability for reads; heartbeat writes may degrade gracefully as best-effort.
- Retain per-title progress for 3 years, then archive or prune older entries.
Topics
- System Design HLD
- Media Watch-History
- Data Timeseries
- Scaling Write-Heavy
- Data Consistency