System Design Core Concepts
Latency 与 Throughput
理解 latency/throughput 的取舍
latency 是一次操作从开始到完成所花的时间。
throughput 是单位时间内完成的操作数量。
通常目标是:在可接受 latency 下最大化 throughput。例如在 clustering 场景里,active-active 通过更多 nodes 并行处理提升 throughput,也能改善 response time。但如果 node-to-node communication 成为瓶颈,latency 反而会拖慢扩容效果。

典型场景
- 低 latency 优先:online gaming、trading、实时协作
- 高 throughput 优先:batch analytics、log processing、ETL pipeline
常见取舍
- 增加 batch size 可能提升 throughput,但会拉高 latency。
- 增加并发度可能降低平均 latency,但也可能导致 tail latency 变差。
- 使用 async pipeline 可以提高 throughput,但会增加 end-to-end latency。