知识卡片
过宽契约浪费跨服务带宽
跨服务接口若返回整份对象而调用方只需要一个字段,流量会随调用频率放大。原书示例每次返回500 KB、每秒2000次,约为每秒1 GB;若只传200字节,则约每秒400 KB。应按消费者实际需要裁剪字段,降低[[远程延迟会在调用链累积]]所述链路的负担;两组数字均是示意计算,书中后一单位写成 Kbps,实际需按字节/比特口径区分。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Foundations · 查看原书依据
Service B returns 45 attributes, totaling 500 KB, to Service A, which only needs the name (200 bytes).
参考来源
- 位置:《Fundamentals of Software Architecture》第12章《Foundations》(源文件:`OEBPS/ch09.html`)
- 结论依据:原文以心愿单与顾客资料服务示例说明stamp coupling和带宽代价;单位换算在正文标明。
- 原始内容:Service B returns 45 attributes, totaling 500 KB, to Service A , which only needs the name (200 bytes).