The Timeout Chain Problem
You'll learn: Why a single user request touching multiple services can easily blow past its deadline when timeouts aren't carefully orchestrated across each hop.
The Compounding Latency Problem
Imagine a user request that triggers a chain: Client → API Gateway → Service A → Service B → Database. If each hop has a 5-second timeout, the total possible latency is 20 seconds (4 hops × 5s), even though your user expects a response in under 2 seconds.
Each service waits its full timeout before giving up, unaware that upstream services are also waiting. By the time Service B times out, Service A's timeout fires, then the Gateway's—but the user abandoned the request long ago.
Shrinking Timeouts Down the Chain
To meet a 2-second user SLA, you must allocate progressively smaller timeouts at each layer:
- Client/Gateway: 2s total budget
- Service A: 1.5s (leaving 0.5s for gateway overhead)
- Service B: 1s (leaving 0.5s for Service A logic)
- Database call: 500ms (leaving buffer for Service B)
This "timeout budget" ensures that if the database is slow, Service B fails fast, Service A can retry or return a fallback before the gateway timeout expires, and the user gets some response within their expectation window.
The Failure Mode
Without shrinking timeouts, every downstream delay gets multiplied by retry attempts and stacked across layers. A 3-second database hang cascades into 10+ seconds of wasted waiting across the stack—every thread blocked, every connection held.
Key Takeaway: In a multi-hop call chain, each downstream service must have a shorter timeout than its caller, or the total latency budget will be exceeded and upstream callers will waste resources waiting for requests that have already missed their deadline.