TUE · 08.04 · WEEK 02 · DAY 2
Distributed Cache:复制、分片、热点与故障
完整覆盖六个 live deep dives 与 level expectation。今天的主线是 key routing、replication、rebalancing、hot read/write 和 p99。
学习源包
按顺序打开。Hello Interview 与 DDIA 链接都直达今天需要的 live subsection,不做整章地毯式阅读。
Distributed Cache · Potential Deep DivesEXACT SECTION
deep dive;完成后在白板或口述中留下对应证据。
Distributed Cache · 1) How do we ensure our cache is highly available and fault tolerant?EXACT SECTION
deep dive;完成后在白板或口述中留下对应证据。
deep dive;完成后在白板或口述中留下对应证据。
Distributed Cache · 3) How can we ensure an even distribution of keys across our nodes?EXACT SECTION
deep dive;完成后在白板或口述中留下对应证据。
Distributed Cache · 4) What happens if you have a hot key that is being read from a lot?EXACT SECTION
deep dive;完成后在白板或口述中留下对应证据。
Distributed Cache · 5) What happens if you have a hot key that is being written to a lot?EXACT SECTION
deep dive;完成后在白板或口述中留下对应证据。
deep dive;完成后在白板或口述中留下对应证据。
Distributed Cache · Tying it all togetherEXACT SECTION
level expectation;完成后在白板或口述中留下对应证据。
Distributed Cache · What is Expected at Each Level?EXACT SECTION
level expectation;完成后在白板或口述中留下对应证据。
Distributed Cache · Mid-levelEXACT SECTION
level expectation;完成后在白板或口述中留下对应证据。
Distributed Cache · SeniorEXACT SECTION
level expectation;完成后在白板或口述中留下对应证据。
Distributed Cache · StaffEXACT SECTION
level expectation;完成后在白板或口述中留下对应证据。
DDIA Ch6 · 同步复制与异步复制EXACT SECTION
画 ACK 后 primary 宕机、replica 尚未收到数据的 failure window。
DDIA Ch7 · 按键的哈希分片EXACT SECTION
画 key → logical shard → physical node。
DDIA Ch7 · 一致性哈希EXACT SECTION
比较 modulo、固定分片、一致性哈希在节点变更时的搬迁量。
DDIA Ch7 · 倾斜的工作负载与缓解热点EXACT SECTION
分别给 hot read 与 hot write 一个不依赖口号的修复。
DDIA Ch7 · 请求路由EXACT SECTION
在客户端路由与代理路由之间做一个绑定运行条件的选择。
今日验收
- consistent hashing 只减少成员变化时的 remap;不能声称它消灭热点。
- 异步复制的 ACK 语义、最大丢写窗口和节点恢复步骤必须一致。
- 每个性能优化都绑定一个指标,不能用 batching 隐藏 p99 或 freshness 代价。
必须产出:50 节点集群 HLD + ring/routing 图 + replication failure window + hot-key repair matrix。
08:50—10:55
系统设计块保持完整。最后十分钟永远用于无稿 close,防止学习退化为被动阅读。
| 时间 | 今日时间表 |
|---|---|
| 08:50—09:00 | 写今天的判断:扩展性、可用性和低延迟是三条不同的设计轴。 |
| 09:00—09:25 | 读 HA/fault tolerance;比较同步、异步、peer-to-peer 复制并画丢失窗口。 |
| 09:25—09:50 | 读 scale / even distribution;完成容量节点数、logical shard 和 ring version。 |
| 09:50—10:15 | 读 hot read / hot write;为两种热点分别写 detection → mitigation → recovery。 |
| 10:15—10:35 | 读 performance;把 batch/pipeline、连接、序列化、p99 与单机 benchmark 串起来。 |
| 10:35—10:45 | 读 tying together 与 Mid/Senior/Staff;圈出自己尚未主动提出的 Staff 行为。 |
| 10:45—10:55 | 闭卷讲 key 路由、replica 写入和节点故障三条时序。 |
算法模块
NeetCode Tag:Two Pointers。三个 slot 全在同一连续 tag;每题记录 Pattern / Invariant / Bug / Complexity。
14:30—16:15NeetCode Tag · Two Pointers3 required slots
| # | 题目 | 当日目标 | 时间 |
|---|---|---|---|
| 1 | Container With Most Water | 新题 · 较短边决定上界,移动长边没有收益。 | 14:30—15:05 |
| 2 | Trapping Rain Water | 新题 · 左右最大值决定结算哪一侧。 | 15:05—15:40 |
| 3 | Valid Palindrome | 复刷 · 15 分钟内无边界 bug。 | 15:40—16:15 |
20:30—21:15
口述块只接受录音、实际回答或 repair 证据,不用“看完了”作为完成。
20:30—21:15 · 完成 Staff Q&A 01—08。每题先答 90 秒,再展开参考答案;只记录一个需要周日复测的 critical miss。
Detailed lecture notes, audio, recall scripts, PDFs, Staff Q&A, and mock packs are archived locally and are intentionally not published on this site.