知识卡片
网关聚合需守住业务边界
网关可并行调用独立后端并聚合结果,减少客户端编排成本和等待时间;也可做协议转换。但编排顺序可能影响非幂等调用,转换有正确性和计算成本,业务逻辑还可能散落到网关。只把稳定、通用的组合留在网关,并测试调用顺序与转换保真。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
Typically you want to call multiple independent and noncoupled APIs in parallel rather than sequentially in order to save time when gathering results for the consumer. Providing this in the gateway removes the need to independently implement this functionality in each of the consumers. Once again the trade-off is that business logic can become spread across the API gateway and backend systems.
参考来源
- 位置:《Mastering API Architecture》第3章《API Gateways: Ingress Traffic Management》之《Simplify Consumption: Aggregating/Translating Backend Services》(源文件:_epub-src/OEBPS/ch03.xhtml)
- 结论依据:原文给出并行调用、聚合和协议转换用途,同时指出业务逻辑分散、调用顺序影响非幂等结果及转换成本。
- 原始内容:Typically you want to call multiple independent and noncoupled APIs in parallel rather than sequentially in order to save time when gathering results for the consumer. Providing this in the gateway removes the need to independently implement this functionality in each of the consumers. Once again the trade-off is that business logic can become spread across the API gateway and backend systems.