Timeouts & Deadlines

Why every external call needs a timeout, deadline propagation across services, and choosing the right values.

Overview

Every external call needs a timeout

This is non-negotiable. A call without a timeout can hang forever, and under load, hung calls are how services collapse.

SRE Book Chapter 22: "RPCs inherit and decrease deadlines as they descend the stack so a server doesn't waste cycles on a request whose caller already gave up."

Here is what that looks like. A user request starts with a 1 s deadline. Service A receives it with 0.9 s left, Service B with 0.7 s left and Service C with 0.5 s left. Each hop passes down what remains, not a fresh budget. If A's timeout fires, A cancels all of its downstream calls.

> [!IMPORTANT] Pass the deadline down the stack and cancel downstream work when it expires. No work should happen after the user has given up.

Key concepts

  • No timeout = no protection
  • Right timeout value
  • Deadline propagation
  • Cancellation cascade
  • Hard vs soft timeout
  • Timeout pyramid rule

Interview questions

  • Walk me through deadline propagation in a microservice call.
  • How do you choose a timeout value?
  • I've added timeouts everywhere. What ELSE is needed?

Sign up free to read the full topic

More SRE topics

Start free on Cariara · Coding problems · System design studio