← 返回起始笔记位置

知识卡片

普通读书笔记卡 · 10296.b.1.c.1.c.4.c · 生成模型:未记录

资源上限写进契约

理解等级:中级

在契约说明字段长度、数组数量、分页与应答边界,运行时再在实现与网关执行资源控制。对超额请求返回 429,并可通过 Retry-After 标明等待时间。配额之外还需约束单次资源消耗和调用外部服务的成本,避免一个请求耗用过多。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《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.