知识卡片
资源上限写进契约
在契约说明字段长度、数组数量、分页与应答边界,运行时再在实现与网关执行资源控制。对超额请求返回 429,并可通过 Retry-After 标明等待时间。配额之外还需约束单次资源消耗和调用外部服务的成本,避免一个请求耗用过多。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 自定义 Lint 与安全检查 10.2.5 API4:2023 - Unrestricted Resource Consumption · 查看原书依据
Rate-limiting (sometimes called throttling) sets a limit on how often a client can make a request within a window of time. The goal of rate-limiting is to ensure that when one client increases its rate of requests, the service is still able to respond to other clients.
参考来源
- 位置:《Automating API Delivery APIOps with OpenAPI》《第 10 章 自定义 Lint 与安全检查》(10.2.5 API4:2023 - Unrestricted Resource Consumption;来源项目 book-source,extracted/Automating API Delivery APIOps with OpenAPI/_epub-src/OEBPS/Text/chapter-10.xhtml#p140)
- 结论依据:原文说明限流目的、429 响应与 Retry-After 的恢复提示。
- 原始内容:Rate-limiting (sometimes called throttling) sets a limit on how often a client can make a request within a window of time. The goal of rate-limiting is to ensure that when one client increases its rate of requests, the service is still able to respond to other clients.