withsoon
withsoon/System Design/Netflix Data EngineeringPIPELINES

Real-Time Streaming

Cover Flink jobs, watch-time logic, sessionization, watermarks, late data handling, and exactly-once style guarantees.

View Backend Track

Chapter

6 / 17

On this page

Streaming jobs

PIPELINESChapter 610 min

Explain how raw events become trusted real-time metrics and features.

The streaming layer turns raw events into trusted near-real-time facts using keyed state, watermarking, sessionization, and clearly defined metric logic like heartbeat-based watch time.

PIPELINES10 minExplain how raw events become trusted real-time metrics and features.

Quick jumps

Click to jump

Monthly users

200M-250M

Docs use both 200M+ and 250M assumptions

Daily active users

80M

Used for heartbeat and Kafka math

Peak concurrency

15M

Useful for QoE and live ops workloads

Streaming jobs

Visualize the near-real-time processing layer

This is where topics become trusted live facts, alerts, and features.

Streaming job detail

Playback Sessionizer

Seconds to minutes

Input topics

playback.heartbeat.raw, video.buffer.*, video.pause, video.seek

KeyBy

user_id + profile_id + content_id + device_id

State

active session, seen event_ids, watched_segments, pause_count, buffering_seconds

Window

Session windows with inactivity timeout

Watermark

10 minutes

Output

silver.fact_watch_session updates

Failure behavior

Backpressure or state blowup causes lag; checkpoint failures require restart from durable state.

Event animation

heartbeat→
dedupe→
state update→
session close rule→
emit session update
Watch-time rules

Make metric logic visual instead of prose-heavy

Heartbeat truth and coverage logic should be obvious from the timeline.

Interactive timeline

Heartbeats count. Pause does not. Buffering is tracked separately.

10:00:00play
State change
10:00:30heartbeat
Counted watch seconds
10:01:00heartbeat
Counted watch seconds
10:01:30pause
Not counted
10:45:00resume
State change
10:45:30heartbeat
Counted watch seconds
10:46:00heartbeat
Counted watch seconds

Counted watch seconds

120

Paused seconds

Not counted

Buffering seconds

Tracked separately

Toggle definitions

Engagement Watch Time

Counts actual playing time only. Paused and buffering intervals are tracked separately.

Total Watch Time

0–10 min + 5–15 min = 20 minutes

Unique Content Coverage

0–15 min = 15 minutes of unique coverage

Count heartbeat_interval_sec only when is_playing = true, is_paused = false, and the event is valid and non-duplicate.

Track total_watch_seconds, buffering_seconds, session_seconds, and unique_content_seconds_watched as separate metrics.

Use unique_content_seconds_watched / content_duration_seconds for completion_pct, not total_watch_seconds.

If buffering should count for a UX metric, store it separately instead of contaminating engagement watch time.

Sessionization

Turn noisy raw events into trusted sessions

The user should see exactly where pause logic, duplicates, and device changes are handled.

Session output

Normal playback

One playback session with clean start/end, watch seconds, and QoE counters.

Raw events β†’ session

play→
heartbeat→
heartbeat→
heartbeat→
stop

Flink session state

session_idsession_start_timelast_event_timelast_heartbeat_timewatch_secondsbuffering_secondspause_countseek_countseen_event_idswatched_segments

Long pause logic

1

30 min inactivity timeout β†’ close active session

2

4 hour pause continuation β†’ still same logical journey possible

3

24 hour journey threshold β†’ link related sessions into one viewing journey

Late data

Streaming speed still needs correction paths

Watermarks and late updates belong right next to the real-time pipeline story.

Late event simulator

Drag arrival delay to see how the event should be handled.

On-time event

On-time event

Process normally with streaming state and live outputs.

Late but allowed

Update previous windows or sessions if within allowed lateness.

Very late event

Route to late_events and correction flow.

Process normally in the stream path.

Replay flow

Controlled correction, not manual copy-paste.

1

DLQ / quarantine catches malformed, schema-invalid, too-late, or business-rule-failed records

2

Engineer fixes mapping, schema, or transformation logic

3

Replay service marks selected records replayable and republishes to replay.playback.events

4

Streaming and batch pipelines consume replay idempotently

5

Silver and Gold tables are corrected using MERGE / partition overwrite

6

Audit records capture what was replayed, why, by whom, and what changed

DLQ is not data loss storage. It needs owner, SLA, dashboard, replay tooling, and audit.

Say this

Use a compact streaming explanation

This line should separate live facts from official batch truth.

Say This In Interview

The streaming layer turns raw events into trusted near-real-time facts using keyed state, watermarking, sessionization, and clearly defined metric logic like heartbeat-based watch time.

Last reviewed June 2026 Β· By Prasoon Parashar

Numbers are interview assumptions, not real Netflix internal figures.

Was this tab useful?