Scrivio Interview library
DebuggingIntermediate7 min read · updated 12 November 2026

During a downstream slowdown, traffic to that service increased to 27 times normal and it collapsed. Each of three layers retried 3 times. Explain the effect and how to fix it.

Retries multiply across layers: if each of three layers makes 3 attempts, one original request can become 3 x 3 x 3 = 27 attempts at the bottom, so exactly when the downstream slowed down, its traffic rose to 27 times normal and it collapsed. The fix is to retry at one layer only, usually the one closest to the failing dependency or the edge, to cap retries with a retry budget and stop them with a circuit breaker, to add jitter so retries do not synchronise, and to have the overloaded service return 503 with Retry-After so clients back off.

Why this question is asked

Retry storms are one of the most common ways a partial failure becomes a full outage, and they are hard to see in code review because each layer's retry policy looks perfectly reasonable on its own. Interviewers ask this debugging question to see whether we think about a system as a whole, and whether we can explain the arithmetic and the fixes clearly. In this answer, we will recap the setup, work through the multiplication step by step, see why it hits exactly when it hurts most, and then fix it with single-layer retries, retry budgets, circuit breakers, jitter and server-side back-pressure.

1A Quick Recap of the Setup

We have three layers in front of the failing service: an edge gateway calls an orders service, which calls a pricing service, which calls a tax service. Each layer was configured independently with what looked like a safe policy: up to 3 attempts per call. In the question, "retried 3 times" is best read as 3 attempts per layer, which gives the 27; if it meant 3 retries on top of the first call, each layer would make 4 attempts and the factor would be 4 x 4 x 4 = 64, even worse.

When tax slowed down, its callers started timing out, and every timeout triggered a retry.

2Working Through the Multiplication

Follow one user request when tax is failing every call. The gateway calls orders, attempt 1. Orders calls pricing, attempt 1. Pricing calls tax three times, and all three fail, so pricing returns an error to orders. Orders retries pricing, which again calls tax three times. Orders does that three times in total, so tax sees 3 x 3 = 9 calls, and orders returns an error to the gateway. The gateway retries orders three times, and each time tax sees 9 calls. Tax receives 27 calls for one request from one user.

Attempts per original request when tax keeps failing
LayerAttempts it makesCalls reaching the next layer
Gateway -> orders33 calls to orders
Orders -> pricing3 per call3 x 3 = 9 calls to pricing
Pricing -> tax3 per call9 x 3 = 27 calls to tax
One user request becomes 27 calls at the bottom.

Notice that each layer's retries are invisible to the layers below it. Pricing does not know that orders will retry it, and orders does not know that the gateway will retry it. Each makes a local decision that is sensible alone and disastrous in combination.

3Why It Hits Exactly When It Hurts

Retries only fire when calls fail, so the extra traffic arrives at the worst possible time. A service that slows down because it is overloaded receives up to 27 times more requests, which makes it slower, which causes more timeouts, which cause more retries. This is a positive feedback loop: the system pushes itself further from health instead of back towards it. Even after the original cause is fixed, the retry traffic can keep the service down, because it never gets a quiet moment to recover.

The timeouts make it worse. If each layer's timeout is long, the waiting calls also pile up threads and connections in orders and pricing, so those services fail too, and the outage spreads upward. Users then refresh the page, adding a fourth multiplier the system cannot control.

4Fix 1: Retry at One Layer Only

The most important fix is to decide where retries happen and turn them off everywhere else. Usually the best place is the layer closest to the failure, pricing calling tax in our case, because it knows that dependency's failure modes and has the shortest path to it. The alternative is the edge, where a single retry policy can see the whole request. What we must avoid is retrying at every hop. Layers that do not retry should fail fast and pass the error up, ideally marking it as already retried, for example with a response header, so upstream layers do not try again.

With retries only at pricing, the worst case is 3 calls to tax per user request instead of 27.

5Fix 2: Retry Budgets and Circuit Breakers

Even a single layer of retries can double or triple traffic during an outage. A retry budget caps retries as a share of normal traffic, for example retries may add at most 10 or 20 percent to the requests a client sends. When most calls are failing, the budget runs out and further failures are returned immediately. Envoy-based meshes offer retry budgets directly, and in Java we can build one with a simple token bucket.

Java
class RetryBudget {
private final AtomicLong tokens = new AtomicLong(0); // in tenths of a retry
void onRequest() { tokens.updateAndGet(t -> Math.min(t + 1, 1000)); } // each request earns 0.1 retry
boolean tryRetry() { // a retry costs 1.0
return tokens.getAndUpdate(t -> t >= 10 ? t - 10 : t) >= 10;
}
}
// normal traffic: 1,000 req/s earn 100 retries/s at most -> retries add at most 10%
// outage: tokens drain within a second, retries stop, failures return immediately
CircuitBreakerConfig breaker = CircuitBreakerConfig.custom() // Resilience4j
.failureRateThreshold(50) // open at 50% failures
.slidingWindowSize(100) // over the last 100 calls
.waitDurationInOpenState(Duration.ofSeconds(10)) // then try a few calls again
.build();

A circuit breaker is the other half. It watches the failure rate to a dependency, and when it crosses a threshold it opens: calls fail immediately without being sent, for a cooling-off period. Then it lets a few trial calls through and closes again if they succeed. During the outage in the question, an open breaker at pricing would have reduced the traffic to tax to almost nothing, which is exactly what tax needed to recover.

6Fix 3: Jitter and Server-Side Back-Pressure

Retries without jitter are synchronised. If thousands of calls time out at the same moment, they all retry after exactly 200 ms, then exactly 400 ms, hitting tax with waves of load. Adding random jitter to each backoff spreads those retries out, so the service sees a steady trickle instead of spikes.

The overloaded service can also help itself. When tax is at capacity, it should shed load by returning 503 Service Unavailable quickly, with a Retry-After header saying when to try again, instead of accepting work it cannot finish and timing out. A fast 503 costs much less than a slow timeout, and well-behaved clients wait for the Retry-After period, which gives the service room to recover.

Step throughContaining a slowdown instead of amplifying it
  1. Tax slows down
  2. Pricing call failsonly pricing retries
  3. Retry budget left and breaker closed?
    YesRetry with jittered backoffNoFail fast, return error
  4. Tax overloaded?
    YesTax returns 503 with Retry-AfterNoRequest served
  5. Breaker opens at 50% failurestraffic to tax drops, it recovers

5 steps in order. Play them, or step through them one at a time.

Each mechanism removes load at the moment the service needs relief.

7Follow-up questions

How would you find a retry storm in production?

Compare request rates at each layer. If tax receives many times more requests than the edge during an incident, while user traffic is flat, retries are multiplying. Distributed traces show it directly: one trace containing many repeated spans to the same dependency. Retry counters per client, from doBeforeRetry or Resilience4j metrics, confirm which layers are retrying.

Is the edge or the deepest layer the better place to retry?

The deepest layer close to the failure usually reacts fastest and knows the dependency best, so it is a good default for transient blips. The edge sees the whole request and the user's deadline, so it suits retries of whole idempotent operations. Either works, as long as it is one place and the others fail fast.

Do service meshes cause retry storms too?

They can, if the mesh retries and the application also retries, because the multiplication is the same. When introducing a mesh, we decide which layer owns retries and switch off the other, and mesh retry budgets help cap the damage.

8Conclusion

In this answer, we saw that retries multiply across layers, so three layers making 3 attempts each turn one request into 27 calls at the bottom, and that this extra load arrives exactly when the dependency is already struggling, creating a feedback loop that keeps it down. The fixes are to retry at one layer only, cap retries with a retry budget, stop calls to a failing dependency with a circuit breaker, add jitter so retries do not come in waves, and let the overloaded service shed load with fast 503 responses and Retry-After.

What to say in the interviewAbout 90 seconds aloud

Open with

The 27 comes from multiplication. Each of the three layers makes up to 3 attempts, and the retries of each layer are invisible to the others. When the bottom service fails, the layer above calls it 3 times, the layer above that retries that whole call 3 times, and the edge retries again 3 times, so one user request turns into 3 times 3 times 3, 27 calls at the bottom.

Then, if they want more

And it happens only when things fail, so the slow service gets 27 times its normal traffic at exactly the moment it is overloaded, gets slower, causes more timeouts and more retries, and cannot recover even after the original cause is gone.

To fix it, first I would retry at one layer only, usually the one closest to the failing dependency, and make the other layers fail fast.

Second, I would add a retry budget so retries can add at most about 10 to 20 percent to normal traffic, and a circuit breaker that opens when, say, half the recent calls fail, so traffic to the dependency drops to almost nothing and it can recover. Third, jitter on the backoff so retries do not arrive in synchronised waves.

And the overloaded service should shed load with a quick 503 and a Retry-After header rather than accepting work and timing out.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "During a downstream slowdown, traffic to that service increased to 27 times normal and...": https://scrivio-interview-library.netlify.app/spring-boot/http-clients/7b73267a21/