Chapter 11 - Performance
本章目标
看完本章后,你应该可以回答:
- latency、throughput、scaling bottleneck 怎么判斷?
- CloudFront、ElastiCache、read replica、DAX 各自改善什么?
- EC2 instance family、Auto Scaling、Lambda concurrency 怎么影响性能?
- 全球用户与高流量题目怎么拆?
一句话
Performance 是让系统在需求流量下维持可接受的 latency、throughput 和 user experience。
架构位置
Performance 可能发生在 edge、network、compute、database、cache、queue、storage 任一层。
常见服务与概念
- CloudFront
- Global Accelerator
- ElastiCache
- RDS read replica
- DynamoDB DAX
- Auto Scaling
- EC2 instance family
- Lambda concurrency
- S3 Transfer Acceleration
PM 视角
PM 要把「很慢」拆成可讨论的需求:哪个地区慢?读慢还是写慢?尖峰时慢还是一直慢?需要即时回应还是可异步?
Developer / DevOps 视角
工程师要先定位 bottleneck,再选服务:global latency 看 edge,database read bottleneck 看 replica/cache,burst traffic 看 scaling/queue。
考试怎么问
常见题型会问:
- 全球静态内容加速
- database read latency 太高
- API burst traffic 太高
- high throughput compute workload
- S3 大档跨区上傳性能
常见陷阱
| 陷阱 | 正确方向 |
|---|---|
| 所有性能问题都加 EC2 | 先找 bottleneck layer |
| CloudFront 只用于网站图片 | API / dynamic content 也可能受益,但要看题目 |
| cache 解决所有 DB 问题 | cache 适合 read-heavy / repeated reads,不适合所有一致性需求 |
| read replica 解决 write bottleneck | read replica 主要改善读取 |