WEEK 04 · 2026-08-20 · THU

Google Docs:WebSocket scale、storage compaction、load/update recovery

完整覆盖 Google Docs deep dives:millions WebSockets、storage control、additional deep dives、document load/update H4、level expectations。

今日固定时间表

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

08:30 wake起床、早餐、准备白板;不安排预读或算法。
08:50—09:1508:50—10:55 system design
Bad/Good/Great 拆解 — Bad: 每次保存全文;Good: op log + snapshot;Great: compacted snapshots + replay + transform/rebase + room fencing。
09:15—09:5008:50—10:55 system design
精确原文 — 读 Google Docs potential deep dives、When Loaded/Updates H4、levels 和 references。
09:50—10:2508:50—10:55 system design
故障时序 — room owner pause、op log replay、snapshot compaction、slow websocket client、presence expiry。
10:25—10:5508:50—10:55 system design
恢复和指标 — 补 op-lag、snapshot age、transform conflict rate、reconnect recovery、storage bytes/doc。
14:30—16:15NeetCode Tag · Sliding Window
三道题在下方独立算法表执行。
20:30—21:1520:30—21:15 Staff Q&A:op ordering、compaction、room owner lease、presence as soft state。

算法模块

连续单一 NeetCode Sliding Window tag;每天 3 个 NEW slot,每题 30 分钟作答 + 5 分钟证据,正好 105 分钟。每天 timed review = 0,满足不超过 1。

#Problem / modePatternInvariantBug riskTimeSpace
10Find K-Length Substrings With No Repeated Characters
NEW · 30m solve + 5m evidence
固定长度唯一窗口窗口长度不超过 k 且字符频次可判唯一。重复字符跨左边界;不足 k 也计数。O(n)O(alphabet)
11Alternating Groups II
NEW · 30m solve + 5m evidence
环形固定长度窗口连续交替 run 覆盖下标模 n,起点只计 n 个。重复计算第二圈起点;k=1。O(n + k)O(1)
12Longest Substring Without Repeating Characters
NEW · 30m solve + 5m evidence
可变唯一窗口窗口内字符全部唯一。lastSeen 小于 left 时错误回退 left。O(n)O(alphabet)

闭卷起手

15 分钟闭卷回答:document room owner 挂了、op 已持久化但广播失败、客户端 baseRevision 落后,分别怎么恢复?

Hello Interview 精确目录

day 页面使用 canonical data-toc-id/H4 anchors;周级 overview 不放小节链接。

项目精确 canonical sectionDisposition今天怎么用
Google DocsPotential Deep Divesdeep divescale and storage
Google Docs1) How do we scale to millions of websocket connections?deep diveconnection fanout and document room ownership
Google Docs2) How do we keep storage under control?deep divesnapshots, compaction, op retention
Google DocsSome additional deep dives you might considerdeep diveextra prompts recorded for Staff pressure
Google DocsWhen the Document is Loadeddeep diveH4 load snapshot + missing ops
Google DocsWhen Updates Happendeep diveH4 submit op + transform/broadcast
Google DocsWhat is Expected at Each Level?level expectationcalibrate interview depth
Google DocsMid-levellevel expectationbasic collaboration flow
Google DocsSeniorlevel expectationOT/CRDT, scale, failure
Google DocsStafflevel expectationstorage compaction, correctness and recovery
Google DocsReferencesreference metadatarecorded but not scheduled as passive reading

DDIA 精确决策卡

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

项目问题精确 DDIA subsection改变的系统决定
Google Docs 的 OT/CRDT 具体改变哪个系统决定?Ch6 · CRDT 与操作变换operation log 存语义操作和 revision/context,而不是只存最终文本覆盖。
文档 room 内操作是否需要一个共享顺序?Ch10 · 共享日志作为共识服务端 sequencer/op log 给文档操作建立单调 revision;客户端基于 revision transform/rebase。
协同服务进程暂停会怎样破坏锁/租约?Ch9 · 进程暂停不要用本地进程假设持有无限租约;room ownership 需要心跳、lease expiry 和 fencing。

本日项目 artifacts

脚本、音频、PDF 与 mock evidence 直接从对应日打开。

今日产出、修复与英语 recall

课程角色CORE · all deep dives + Bad/Good/Great
必须交付Google Docs deep-dive matrix:connection scale/storage/op replay/load/update/levels,各含 invariants、failure windows、metrics。
修复规则如果 storage 只说“压缩”,补 snapshot interval、op retention、replay upper bound 和 audit trail。
English recall
English recall: “A document room needs a recoverable operation log and bounded replay, not an infinite WebSocket buffer.”
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.