WEEK 03 · 2026-08-13 · THU

FB Live Comments:server coordination、mega streams、disconnect recovery

完整覆盖 Live Comments deep dives:实时广播、百万并发、mega stream、断线补漏和降级。

今日固定时间表

08:30 wake 只保留起床;学习从 08:50 开始。三块窗口不互相挤占。

08:30 wake起床、早餐、准备白板;不安排预读或算法。
08:50—09:1508:50—10:55 system design
Bad/Good/Great 拆解 — polling/WebSocket/SSE,pub-sub all/partition/co-location/dispatcher,sampling/CDN snapshot。
09:15—09:5008:50—10:55 system design
精确原文 — 读 Live Comments 全部 potential deep dives、Part 1/2 与 level expectation。
09:50—10:2508:50—10:55 system design
故障时序 — 画断线、重连到不同 server、Last-Event-ID replay、consumer lag、broker partition hot spot。
10:25—10:5508:50—10:55 system design
降级与指标 — 定义 end-to-end comment latency、reconnect gap、viewer connection fanout、sample rate、snapshot age。
14:30—16:15NeetCode Tag · Stack
三道题在下方独立算法表执行,避免系统设计表格挤压算法细节。
20:30—21:1520:30—21:15 Staff 追问:dispatcher 为什么不是单点?SSE buffer 溢出时用户看见什么?

算法模块

连续单一 NeetCode Stack tag;每天 3 题,14:30—16:15 完成。

#ProblemInvariant focus执行
10Evaluate Reverse Polish Notation限时复盘:整除截断和负数。35 分钟限时 + 5 分钟 invariant/bug risk
11Generate Parentheses限时复盘:生成顺序与剪枝。35 分钟限时 + 5 分钟 invariant/bug risk
12Daily Temperatures限时复盘:相等温度不弹。35 分钟限时 + 5 分钟 invariant/bug risk

闭卷起手

先暴露自己的当前模型,再用 live headings 修正。

15 分钟闭卷回答:一个直播间 50K、5M、50M viewer 时,连接、广播、历史补漏分别怎么退化。

Hello Interview 精确目录

day 页面必须链接到具体 section anchors;周级 overview 不放小节链接。

项目精确 section anchorDisposition今天怎么用
FB Live CommentsPotential Deep Divesdeep divemove to realtime scaling
FB Live Comments1) How can we ensure comments are broadcasted to viewers in real-time?deep divepolling vs WebSocket vs SSE
FB Live Comments2) How will the system scale to support millions of concurrent viewers?deep diveserver coordination and mega-stream strategy
FB Live CommentsPart 1: Server Coordinationdeep divepub/sub, co-location, dispatcher
FB Live CommentsPart 2: Mega Streamsdeep divesampling and CDN snapshot fallback
FB Live Comments3) How do we handle client disconnections and ensure viewers don't miss comments?deep diveLast-Event-ID, replay and catch-up
FB Live CommentsWhat is Expected at Each Level?level expectationcalibrate depth
FB Live CommentsMid-levellevel expectationbasic realtime pipe
FB Live CommentsSeniorlevel expectationscale and disconnection
FB Live CommentsStaff+level expectationmega stream overload, product degradation, observability

DDIA 精确决策卡

只读能改变今天设计决定的小节。

项目问题精确 DDIA subsection改变的系统决定
评论生产速度超过某些消费者时系统应该做什么?Ch12 · 当消费者跟不上生产者时普通直播允许丢低价值实时动画但不丢可回放 comment log;mega stream 可切采样/CDN snapshot。
断线后是否能重播旧评论?Ch12 · 重播旧消息reconnect/catch-up 可以重放 since cursor;服务端要控制 retention、limit 与过期后的 snapshot/fallback。
直播评论如何把状态变化主动推给客户端?Ch13 · 将状态变更推送给客户端SSE 是服务器推送的状态变化流;客户端仍以 cursor/log 作为恢复边界。

今日产出与修复规则

课程角色CORE · all deep dives + Bad/Good/Great
必须交付Live Comments deep-dive matrix:real-time broadcast、server coordination、mega streams、disconnect recovery,各含 failure/recovery/metrics。
修复规则如果 mega stream 仍坚持“所有评论推给所有人”,补产品降级:sampling、ranked comments、CDN/poll snapshot。
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.