Quick reference
- Is the operation safe to run twice?
- Which errors will succeed on a second try?
- What deadline covers every attempt?
- Who owns the budget when it runs out?
- Can the dependency absorb the extra load?
Explained
Five questions before the code. First, ask whether the operation is safe to run twice, or carries an idempotency key that makes it safe. If not, the retry is a duplicate waiting to happen. Second, ask which errors will actually succeed on a second attempt. Connection resets and 503s usually will; a 400 or a 422 will not.
Third, ask what deadline covers every attempt and every backoff. A retry that cannot finish before the caller gives up is latency with extra steps. Fourth, ask who owns the retry budget, and what happens when it is spent. If the answer is nobody, the budget is infinite. Fifth, ask whether the dependency can absorb the extra load. If it is already failing, the retry is a vote for the outage.
The honest caveat: the most common wrong answer is yes to all five, given verbally, with no measurement behind any of them.
Your turn: Which question does your team skip most often?
Related on this site
More notes: Reliability patterns
Open in the notes app: search, filters, copy This note on GitHub