在分布式系统中,调用会失败。带退避的重试从暂时性错误中恢复;电路断路器防止您继续调用一个真正宕机的依赖。它们是互补的:对于短暂故障进行重试,在中断时断路。
指数退避重试 + jitter
对于暂时性故障(超时、短暂网络中断、503s),进行重试——但指数退避并添加 jitter,以便重试分散开来,而不是同步成惊群。
text
attempt 1 → wait ~1s (+ random jitter)
attempt 2 → wait ~2s (+ random jitter)
attempt 3 → wait ~4s (+ random jitter)
→ cap at maxRetries (e.g. 3) and a max delay → don't retry forever
关键注意事项:
