Scrivio Interview library
ScenarioIntermediate6 min read · updated 12 November 2026

A service retries failed downstream calls 5 times on every layer: the HTTP client, a @Retryable service method and the caller's own loop. During a downstream outage traffic to it grows sharply. What is going on and what policy would you set?

Retries at three layers multiply: 5 attempts in the caller's loop, each making 5 attempts through @Retryable, each making 5 attempts in the HTTP client, gives up to 125 calls for one original request, so an outage turns into a retry storm that keeps the downstream down. The policy is to retry at one layer only, usually the one closest to the call, with a small attempt count, exponential backoff with jitter and an overall deadline, a circuit breaker that stops calls when the downstream is clearly down, and retries only for transient errors such as timeouts or 503, never for 4xx.

Why this question is asked

Retries feel like pure safety, so teams add them wherever a failure is seen, and each layer looks reasonable on its own. The danger only appears when the layers combine during a real outage, and then the service that was supposed to be resilient becomes the biggest source of load on the system that is trying to recover. Interviewers like this scenario because it needs arithmetic, a policy and an understanding of why the policy works. In this answer, we will recap what a retry does to load, count the calls the current setup makes, see why it prevents recovery, and then build the policy layer by layer.

1A Quick Recap: What a Retry Costs

A retry repeats a failed call in the hope that the failure was temporary. When failures are rare and short, this is cheap: 1 percent of calls fail, we retry them once, and load rises by 1 percent. But a retry always adds load to the system that just failed. During an outage, almost every call fails, so every call is retried, and the load on the struggling system grows by the attempt count.

That is why retries help with blips and hurt during outages, and why a retry policy needs a way to stop.

2Counting the Calls

Each layer makes up to 5 attempts, and each attempt of an outer layer triggers the full set of attempts of the inner layers. So the numbers multiply rather than add.

Java
// caller loop: 5 attempts
// -> @Retryable service: 5 attempts each
// -> HTTP client: 5 attempts each
int perRequest = 5 * 5 * 5; // 125 calls to the downstream for one request
int normalRps = 200;
int outageRps = normalRps * perRequest; // 25,000 calls per second during the outage
Calls per original request
Layers retryingAttempts eachTotal downstream calls
HTTP client only55
HTTP client and @Retryable525
Client, @Retryable and caller loop5125
One layer, 3 attempts, breaker open30 to 3

So a downstream that normally serves 200 requests per second from us receives up to 25,000 per second exactly when it is weakest. If it was down because of overload, it cannot recover while this continues, and if it restarts, the queued retries knock it over again. This pattern is called a retry storm.

Timing makes it worse: if each attempt waits for a 2 second timeout, one original request can hold a thread for minutes, so our own service also runs out of threads.

3Rule 1: Retry at One Layer

We pick one layer to own retries, usually the one closest to the call, such as the HTTP client or a single @Retryable method that wraps it. That layer knows what the error was, a timeout, a 503 or a refused connection, and can decide whether it is worth retrying. The layers above treat a failure as final: they report it, return an error, or put the work on a queue for later.

The attempt count should be small, usually 2 or 3. Most transient failures clear within one retry; if three attempts fail, a fourth rarely succeeds and only adds load.

4Rule 2: Backoff With Jitter and an Overall Deadline

Between attempts we wait, and each wait is longer than the last, for example 100 ms, then 200 ms. That is exponential backoff. Jitter adds randomness to each wait, so that thousands of requests that failed at the same moment do not retry at the same moment and arrive as a synchronised wave.

An overall deadline caps the total time: if the user's request has a budget of 2 seconds, the retries must fit inside it, and an attempt that cannot finish before the deadline is not started. Without a deadline, attempt count times timeout can far exceed what any caller is waiting for.

Java
@Retryable(retryFor = TransientDownstreamException.class,
maxAttempts = 3,
backoff = @Backoff(delay = 100, multiplier = 2, maxDelay = 1000, random = true))
public Quote fetchQuote(QuoteRequest r) {
return client.quote(r); // HTTP client: 400 ms read timeout, no retries of its own
}
// worst case: 3 x 400 ms + about 100..200 + 200..400 ms of waiting, under a 2 s budget

5Rule 3: A Circuit Breaker Stops the Storm

Backoff reduces the rate of retries but does not stop them. A circuit breaker does. It counts recent failures, and when the failure rate passes a threshold, say 50 percent over the last 50 calls, it opens: further calls fail immediately without touching the downstream. After a wait, it lets a few trial calls through, and closes again if they succeed.

So during an outage the downstream sees almost no traffic from us, which gives it room to recover, and our threads are freed instantly instead of waiting on timeouts. Resilience4j provides the breaker in Spring applications, and the retry sits inside it so that a whole retried call counts as one outcome.

Step throughOne call with retry inside a breaker
  1. Breaker open?failure rate above 50 percent
    YesFail fast, no callNoMake the call
  2. Transient error?timeout, 503, connection refused
    YesBack off with jitterNoReturn result or error
  3. Attempts and deadline left?max 3, within 2 s
    YesRetry the callNoGive up, record failure

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

6Rule 4: Retry Only Transient Errors

Not every failure is worth repeating. A timeout, a refused connection, a 503 Service Unavailable or a 429 Too Many Requests (respecting its Retry-After header) may succeed on a second try. A 400 Bad Request, 401, 403, 404 or 422 will fail exactly the same way every time, because the request itself is the problem, so retrying them is pure waste. The retry layer should map these explicitly and treat unknown errors as not retryable.

For non-idempotent calls, such as creating a payment, retries also need an idempotency key, so a repeated request cannot do the work twice.

7Follow-up questions

Where would you put the single retry layer?

Usually at the client that talks to the downstream, because it sees the raw error and the timeout and can classify it. If several services call the same downstream through a shared client library, putting the policy in that library makes it consistent everywhere.

What is a retry budget?

A limit on retries as a fraction of normal traffic, for example retries may add at most 10 percent on top of first attempts. When the budget is spent, failures are returned without retrying. It protects the downstream even before a circuit breaker opens.

How would you notice a retry storm in production?

Compare downstream request rate with our incoming request rate; a ratio far above 1 means retries are multiplying. Retry metrics from Resilience4j or Spring Retry listeners, and the circuit breaker state, make it visible on a dashboard.

8Conclusion

In this answer, we saw that nested retries multiply to 125 calls per request and keep a failing downstream down. The fix is one retry layer close to the call with 2 or 3 attempts, exponential backoff with jitter inside an overall deadline, a circuit breaker that stops traffic during an outage, and retries only for transient errors.

What to say in the interviewAbout 90 seconds aloud

Open with

What's going on is a retry storm. The retries multiply instead of adding: the caller's loop makes 5 attempts, each goes through a @Retryable method that makes 5, and each of those goes through an HTTP client that makes 5, so one original request can become 125 downstream calls.

Then, if they want more

At 200 requests a second that's up to 25,000 calls a second, exactly when the downstream is weakest, so it can't recover, and our own threads pile up waiting on timeouts. The policy I'd set is: retry at one layer only, normally the client closest to the call, because it sees the actual error.

The layers above treat a failure as final. Two or three attempts are enough. Waits use exponential backoff with jitter, for example 100 then 200 milliseconds randomised, so failed requests don't retry in a synchronised wave, and there's an overall deadline so all attempts fit within the caller's time budget.

Then a circuit breaker, for example Resilience4j, wraps the call: when the failure rate passes a threshold it opens and fails fast without calling the downstream, then lets a few trial calls through to test recovery.

Finally, I'd only retry transient errors like timeouts, refused connections, 503 and 429 with Retry-After, never 4xx errors like 400 or 404, and use idempotency keys for anything that changes state.

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 "A service retries failed downstream calls 5 times on every layer: the HTTP client, a...": https://scrivio-interview-library.netlify.app/spring-boot/spring-utilities/353f29f889/