الانتقال إلى المحتوى
Software ArchitectureSystem Design· 8 دقائق للقراءة

More Retries Can Mean a Bigger Outage: Backoff, Jitter and Retry Budgets

Retries multiply across layers, arrive in waves and add load to whatever is already overloaded. Retry at one layer, with jitter, under a budget.

ReadIn

مقال كل يوم يفرق معاك

21 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

During a sale, the inventory database slows down under a burst of orders and some queries time out. The gateway, the Orders service and the Inventory service each retry failed calls three times, a policy every team added separately "for resilience". Within minutes the database is receiving far more queries than at the peak of the burst, so it slows further, so more calls time out and get retried. The team adds database capacity and nothing improves. The load only drops when someone ships a hotfix that turns retries off.

The common misconception

The belief: retrying failed calls more times always makes a system more reliable. If one retry is good, three are better, and every layer that talks to the network should have its own.

Smart developers believe it because it's true most of the time. Amazon's Builders' Library explains why: "Often, trying the same request again causes the request to succeed." Systems rarely fail as a single unit; they suffer partial or short-lived failures. Most client libraries retry by default, and in testing, failures are random and independent, so a retry nearly always wins. The half-truth is that retries help when failures are rare and independent. When failures come from overload, a retry adds load to the very thing that is failing. The article on Claude API errors covers which errors from one API deserve a retry; this one is about what retries do to a whole system.

What actually happens

Retries are selfish

The Builders' Library puts it bluntly: "Retries are “selfish.” In other words, when a client retries, it spends more of the server's time to get a higher chance of success." That's a good deal while failures are rare. But "When failures are caused by overload, retries that increase load can make matters significantly worse. They can even delay recovery by keeping the load high long after the original issue is resolved."

Google's SRE book walks through the same spiral: an overloaded backend fails some requests, clients retry them, and the backend now receives its normal traffic plus the retries. Fewer requests succeed on the first attempt, so even more get retried, and "the retries themselves may be keeping the backend in an overloaded mode."

Layers multiply

Each layer's retries apply to every attempt from the layer above. This short simulation counts the calls that reach a database that fails everything:

C# RetryMath.cs
int dbCalls = 0;bool Database() { dbCalls++; return false; } // overloaded: every call fails// A layer calls the one below it up to `attempts` timesFunc<bool> Layer(Func<bool> below, int attempts) =>    () => Enumerable.Range(0, attempts).Any(_ => below());// Gateway -> Orders -> Inventory -> Database, 3 attempts per hopLayer(Layer(Layer(Database, 3), 3), 3)();Console.WriteLine($"Every layer retries: {dbCalls} database calls");dbCalls = 0;Layer(Layer(Layer(Database, 3), 1), 1)(); // only Inventory retriesConsole.WriteLine($"One layer retries:   {dbCalls} database calls");

Run on .NET 10, it prints 27 database calls for one user action when every layer retries, and 3 when only one does. The SRE book gives the general rule: one request "may produce a number of attempts as large as the product of the number of attempts at each layer to the lowest layer", so three layers with four attempts each reach 64.

Retries that wait the same time arrive together

Backoff helps, but only partly. "If all the failed calls back off to the same time, they cause contention or overload again when they are retried." Marc Brooker's simulations on the AWS Architecture Blog show that plain still leaves "clusters of calls". His fix is : with "Full Jitter", each client sleeps a random time between zero and the capped exponential delay. With 100 contending clients, that cut the number of calls by more than half. The SRE book's advice is the same: "Always use randomized exponential backoff when scheduling retries."

A per-request limit isn't a system limit

Three attempts per request can still nearly triple a struggling cluster's traffic: in the worst-case example of the SRE book's chapter on overload, requests grow "to somewhere just below 3X." Google's answer is a per-client : a request is only retried while retries are below 10% of the client's requests, which "reduces the growth to just 1.1x in the general case". The Builders' Library describes the same idea as a token bucket that "allows all calls to retry as long as there are tokens, and then retry at a fixed rate when the tokens are exhausted."

The fix: one layer, jitter and a budget

C# InventoryClient.cs
// Orders service. Gateway and Inventory have the same looppublic sealed class InventoryClient(HttpClient http){    public async Task<Stock> GetStockAsync(string sku, CancellationToken ct)    {        for (int attempt = 1; ; attempt++)        {            try { return (await http.GetFromJsonAsync<Stock>($"/stock/{sku}", ct))!; }            catch (Exception) when (attempt < 3) // retries 404s too            {                await Task.Delay(1000, ct); // every client wakes up together            }        }    }}

Three changes. Only one layer retries: the Orders service, right above the failing dependency, which matches the SRE book's rule that requests "should only be retried at the layer immediately above the layer that is rejecting them." Only failures that can succeed are retried: no response or a 5xx, never a 404. And RetryBudget is one token bucket shared by every call to Inventory: each request adds a tenth of a token, each retry spends a whole one, so retries stay near 10% of traffic and stop when an outage drains the bucket. The call is a read, so it's safe to repeat; retrying writes needs the idempotency covered in the article on idempotent consumers.

ApproachWhen the dependency is overloaded
Immediate retries at every layerLoad multiplies by the attempts at each layer
Exponential backoff, no jitterFewer calls, still arriving in synchronized waves
Backoff with full jitterRetries spread out, but nothing caps their total
Retry budget per dependencyRetries stay a small fraction of traffic
Circuit breakerCalls stop entirely; AWS warns it adds modal behavior and can slow recovery

How to apply it in your project

  1. Count the retry layersFor one user action, list every layer that retries: your loops, HTTP handlers, SDKs, database drivers and message redelivery. Multiply their attempts.
  2. Keep one layerRetry right above the dependency that fails, and make the others fail fast or degrade, such as showing a page without recommendations.
  3. Back off with jitter, within a deadlineUse capped exponential backoff with full jitter, a small attempt limit, and a total time that fits what the user is waiting for.
  4. Add a budget and watch itCap retries per dependency, for example to a tenth of requests, and alert when the retry rate climbs.

Key takeaways

  • Retries help with rare, independent failures and hurt when failures come from overload.
  • Retries at several layers multiply: three layers of three attempts send 27 calls to the bottom.
  • Backoff without jitter still produces synchronized waves; full jitter spreads them out.
  • A per-request limit doesn't cap total load; a retry budget per dependency does.
  • Retry at one layer, only errors that can succeed, and check what your libraries already retry.

📚 المصادر

  1. Timeouts, retries, and backoff with jitter — Marc Brooker, Amazon Builders' Library (2019)
  2. Exponential Backoff And Jitter — Marc Brooker, AWS Architecture Blog (2015)
  3. Addressing Cascading Failures — Site Reliability Engineering, Google
  4. Handling Overload — Site Reliability Engineering, Google
  5. Build resilient HTTP apps: Key development patterns — .NET, Microsoft Learn

التعليقات (0)