What is a retry budget, and how is it different from limiting the attempts per request?
Sketch your own answer first, then compare it with the one below.
A strong answer
A limit on attempts per request caps retries for each request on its own, for example three tries in total. It sounds safe, but when the dependency fails, every request uses all of its attempts, so the load is multiplied by the limit.
A retry budget caps retries across requests. It might allow retries equal to a tenth of the recent requests. One way to build it is a token bucket: each new request adds a fraction of a token, and each retry costs a whole one. When the bucket is empty the client does not retry and the request fails immediately.
The result is that extra load is bounded by that fraction, however badly the dependency fails. During a blip, the budget is enough to retry the few failures. During an outage, it runs out and the client stops adding load.
The budget can sit per process or per client. A per-request limit is still useful for a single request that keeps failing. The usual practice is to use both.
Per-request limits multiply the load by the limit. A budget bounds it at the stated fraction.
Sources
- Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy (2016). Site Reliability Engineering, chapter 22, Addressing Cascading Failures.
- Noah Eisen, Eric Gribkoff (2024). gRPC Retry Design.