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

Per-Hop Timeout Budgets

Allocating remaining time budget to each downstream service call, leaving buffer for network overhead and processing.

Per-Hop Timeout Budgets

What you'll learn: How to allocate your remaining timeout budget across multiple service hops while leaving buffer for network overhead and processing.

The Problem with Simple Timeout Chains

When your request travels through multiple services (Service A → B → C), you can't just give each service the full original timeout. If A has a 1000ms timeout and passes 1000ms to B, which passes 1000ms to C, you've created a timeout chain problem where downstream services might still be working long after the client has given up.

How Per-Hop Budgets Work

Instead of passing the full timeout downstream, you allocate a portion of your remaining time budget to each hop:

  1. Calculate remaining budget after accounting for time already spent
  2. Reserve buffer time for network latency and your own processing (typically 10-20%)
  3. Pass the reduced budget to downstream services

The Allocation Formula

Downstream timeout = (Remaining budget - Buffer) / Expected hops

For example, if you have 800ms remaining, expect 2 downstream calls, and want a 100ms buffer:

  • Downstream timeout = (800ms - 100ms) / 2 = 350ms per call

Why the Buffer Matters

The buffer accounts for:

  • Network round-trip time to/from the downstream service
  • Your service's processing time (parsing responses, business logic)
  • Timeout propagation overhead itself

Without this buffer, you risk timing out after the downstream service has already responded successfully, wasting resources and creating false failures.

Key Takeaway: Per-hop timeout budgets divide your remaining time budget across downstream calls with buffer margins, ensuring the entire chain respects the original deadline while preventing cascading timeout failures.