Step 1 · The pattern
Workers, and a call to someone else
A service answers requests with a small pool of workers. Product pages also need the reviews API, so their worker waits for that reply. Other pages, like search and cart, never call it.
- request / call
- answered
In short
Timeouts: how it works and how it breaks
A service has a fixed number of workers, and a worker that is waiting for a reply can do nothing else. If a call to a dependency has no timeout, or a default measured in minutes, one slow dependency collects every worker. Then requests that never needed that dependency fail as well, because nobody is free to take them. A deadline changes this: when the reply has not come in time, the caller gives up, returns an error and the worker goes back to the pool. Requests that needed the dependency still fail, but quickly, and everything else keeps working. Pick the value from the dependency's normal p99, not from a round number. Pass the time that is left to the next service down, so it does not keep working for a caller that has gone. And limit retries, or the timeouts become extra load.
In Spring Boot
A deadline with a Resilience4j TimeLimiter
resilience4j.timelimiter:
instances:
pricing:
timeoutDuration: 800ms
cancelRunningFuture: true
// PricingClient.java
@TimeLimiter(name = "pricing")
public CompletableFuture<Price> priceFor(String sku) {
return CompletableFuture.supplyAsync(() -> http.getPrice(sku));
}The caller stops waiting after 800 ms and gets a TimeoutException, so its thread is free again. The instance name in the annotation matches the name in the configuration.
Gotcha: @TimeLimiter only works on methods that return a CompletionStage, such as CompletableFuture, or a reactive type. On an ordinary method it throws an error about the return type. It also ends the wait, not the work: cancelling a CompletableFuture does not interrupt the thread running it, so set connect and read timeouts on the HTTP client as well.
Names checked against the official docs on 15 Nov 2026:
How this comes up in interviews
"One dependency turns slow, and pages that never call it start failing too. Explain why, and what you would change."
Then they ask
- How do you choose the timeout value, and what does a value that is too low cost you?
- The caller gave up at the deadline. Is the dependency still doing the work, and what do you do about it?
- With a deadline in place, the pool can still fill during a slowdown at high traffic. Why, and what comes next?
A strong answer covers
- A worker waiting for a reply can do nothing else, so a call with no deadline lets one slow dependency collect every worker.
- With a deadline the caller gives up, returns an error and frees the worker, so requests that never needed the dependency keep working.
- Pick the value from the dependency's normal p99, not from a round number or a client default.
- Pass the time that is left to the next service down, so it stops working for a caller that has gone.
- Limit retries, or the timeouts become extra load on a dependency that is already struggling.
Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.
On one page: the track cheat sheet.
Sources: Deadlines (gRPC documentation) ↗ · Timeouts, retries, and backoff with jitter (Amazon Builders' Library) ↗ · Report a problem
Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.