第 7 周 - 第 2 天 - 2026-09-08 TUE - CORE - YouTube deep dives

YouTube CORE: resumable upload, failed upload, transcode orchestration, CDN invalidation

08:50-10:55 system design14:30-16:15 Trees x320:30-21:15 recall

今日目标

完整覆盖 YouTube deep dives: adaptive bitrate processing, resumable uploads, large-scale upload/watch, plus speeding-up uploads and view-count tangent as bounded extras.

08:50-09:00Set target
写下今天的核心不变量:未完整验证的 rendition/manifest 不能被发布。
09:00-10:05Deep-dive reading
精读 YouTube processing DAG, resumable upload, scale/CDN, level expectations.
10:05-10:45Mechanism sheet
画 multipart resume + transcode DAG + atomic publish + CDN cache key / invalidation.
10:45-10:55Spoken close
脱稿解释 failed upload 与 worker failure 的恢复,不许说 simply retry。
14:30-16:15NeetCode Trees
Exactly three contiguous Trees slots. Each slot is 30m solve + 5m pattern/invariant/bug/complexity evidence.
20:30-21:15Recall / Q&A / repair
20:30-21:15 完成 YouTube Senior+/Staff English recall script drill;对照 PDF 只看标题,不看答案。

Exact source links

Use original Hello Interview titles and current canonical anchors. Inline Bad/Good/Great headings without standalone live anchors link to their parent canonical section.

Original title / direct linkDispositionUse
Potential Deep Divesdeep divemove from HLD to processing/failure/scale
1) How can we handle processing a video to support adaptive bitrate streaming?deep diveDAG, transcoding fanout, manifest generation, publish complete
2) How do we support resumable uploads?deep divechunk fingerprints, ETags, resume by metadata, idempotent chunk status
3) How do we scale to a large number of videos uploaded / watched a day?deep divestateless service, Cassandra/cache, processors, S3, CDN
Some additional deep dives you might considerdeep divespeeding up uploads, resume playback, view counts
What is Expected at Each Level?level expectationcalibrate interview depth
Mid-levellevel expectationfunctional upload and playback
Seniorlevel expectationmultipart upload and post-processing depth
Staff+level expectationtradeoffs, failure windows, scalability and operations

DDIA decision cards

Only exact Ch11/Ch12/Ch13 sections that change today's design are assigned.

DDIA Ch11

工作流调度

Question: YouTube transcode DAG 怎么重启不重做错误的阶段?

把 transcode/split/manifest 建模为有依赖的 job graph;每步输出到对象存储并带 content address/version。

DDIA Ch11

故障处理

Question: worker 或机器故障后,哪些输出可以保留,哪些必须废弃?

job attempt 带 idempotency key;只 publish manifest 指向已验证完整的一组 renditions。

DDIA Ch12

幂等性

Question: 重复 upload complete 或 duplicate view 如何处理?

uploadSessionId、partNumber、eventId、operationId 进入唯一约束或去重状态。

DDIA Ch13

数据库的端到端原则

Question: 为什么 exactly-once 要说成端到端效果而不是 broker 魔法?

链路每端都要 operation id、dedupe、reconcile;单个中间件承诺不够。

算法模块

Contiguous live NeetCode Trees order. No reviews. Three slots per day.

#Problem / modePatternInvariantBug riskTimeSpace
4N-ary Tree Postorder Traversal
NEW - 30m solve + 5m evidence
N 叉树 DFS所有 children 输出后才输出 parent。迭代时 children 顺序要反向入栈。O(n)O(h)
5Invert Binary Tree
NEW - 30m solve + 5m evidence
后序/前序交换每个节点的左右子树最终被交换一次。先覆盖一个 child 丢失引用。O(n)O(h)
6Maximum Depth of Binary Tree
NEW - 30m solve + 5m evidence
DFS 高度depth(node)=1+max(depth children)。空节点返回 1 导致 off-by-one。O(n)O(h)

今日验收

OutputYouTube deep-dive sheet with invariant, triggering failure, recovery, metric, and English recall recording.
Hard failPassive reading without a spoken answer; missing invariant/failure/recovery/metric; any day outside Week 7 touched.
RepairPick the weakest answer and redo it for 8 minutes with one new failure window.
Local study materials
Detailed lecture notes, audio, recall scripts, PDFs, Staff Q&A, and mock packs are archived locally and are intentionally not published on this site.