Course contentsShow
← System Design
Lesson 1103 of 1,91928. Timeouts and DeadlinesFree lesson

Timeout Propagation with Parallel Calls

Applying the same remaining timeout to multiple concurrent downstream requests and handling partial results.

Timeout Propagation with Parallel Calls

You'll learn how to apply a single remaining timeout across multiple concurrent downstream requests and handle the resulting partial responses.

The Challenge of Fan-Out with Timeouts

When a service makes parallel calls to multiple downstream services (fan-out pattern), you still have one overall timeout budget. The question becomes: how do you split that budget across concurrent requests, and what do you do when some complete but others time out?

Applying the Same Remaining Timeout

The key insight: all parallel calls should use the same remaining timeout, not divide it up. If you have 200ms left in your budget and need to call three services concurrently, each call gets a 200ms timeout—not 67ms each.

Why? Because they're running in parallel. The wall-clock time consumed is the maximum of any single call's duration, not the sum. If ServiceA takes 150ms, ServiceB takes 180ms, and ServiceC times out at 200ms, you've only spent 200ms total from your budget.

Handling Partial Results

When timeouts strike during parallel calls, you'll often get partial success:

  • ServiceA: ✓ responded
  • ServiceB: ✓ responded
  • ServiceC: ✗ timed out

Your service must decide: return partial data? Fail entirely? Return with a degraded indicator? The answer depends on whether partial results are useful to the caller.

Implementation Pattern

Calculate remaining time once, apply it to all parallel requests, collect results with timeout awareness, and handle the partial-success case gracefully—either by returning what you have or by failing fast if completeness is required.

Key Takeaway: In parallel downstream calls, apply the same remaining timeout to all concurrent requests and design your system to handle partial results gracefully when some requests time out.