知识卡片

问题卡 · 3938.a.10

重试须幂等且受时限约束

理解等级:中级

自动重试只适用于重发仍安全的请求。连接丢失或部分服务端故障可能是暂时的;客户端请求错误通常要先修正,不能无差别重发所有4xx/5xx。HTTP方法语义还需底层实现兑现。

选定退避或随机等待策略,限制次数和等待量;每次尝试记录警告,耗尽后报告最终失败。串行步骤的等待会累加,必须受任务与作业总时限约束。重试是短期遮蔽故障,不能代替排查持续坏链路。书中退避数字与分类有简化,核心是有界等待与防止同时重试加剧负荷。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体工作流 · 查看原书依据

      The first thing to keep in mind when arranging to retry requests is that you need to make sure the request itself is idempotent. In HTTP, GET, PUT, and DELETE are designed as idempotent on the network. This is usually sufficient, but not always. See the “Discussion” section for details.

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第7章《超媒体工作流》§7.16(来源项目:book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch07.xhtml) - 结论依据:原文以自动重试只适用于重发仍安全的请求的方式说明该用途;同节示例与讨论补充了卡内条件和边界。 - 原始内容:The first thing to keep in mind when arranging to retry requests is that you need to make sure the request itself is idempotent. In HTTP, GET, PUT, and DELETE are designed as idempotent on the network. This is usually sufficient, but not always. See the “Discussion” section for details.