知识卡片
避免按请求体内容路由
按请求体字段决定网关路由会把应用领域结构泄漏到网关配置,字段变化时两处必须同步;解析大请求体还增加计算和延迟。优先用主机名、路径或请求元数据路由。确有按内容分流需求时,应显式评估耦合与性能代价。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
First, this often leaks highly coupled domain-specific information into the API gateway config (e.g., a payload often conforms to a schema/contract that may change in the application, which the gateway will now need to be synchronized with). And second, it can be computationally expensive (and time-consuming) to deserialize and parse a large payload in order to extract the required information for routing.
参考来源
- 位置:《Mastering API Architecture》第3章《API Gateways: Ingress Traffic Management》之《Avoid Routing on Request Payloads》(源文件:_epub-src/OEBPS/ch03.xhtml)
- 结论依据:原文给出两个明确反对理由:领域契约与网关配置耦合,以及反序列化大载荷的计算成本。
- 原始内容:First, this often leaks highly coupled domain-specific information into the API gateway config (e.g., a payload often conforms to a schema/contract that may change in the application, which the gateway will now need to be synchronized with). And second, it can be computationally expensive (and time-consuming) to deserialize and parse a large payload in order to extract the required information for routing.