Concept · No. 038 · November 23, 2026
Propagate deadlines so servers stop work nobody is waiting for
Per-hop timeouts protect each caller but leave every service downstream finishing requests that were abandoned long ago. Passing one shrinking deadline through the call chain turns that waste into early, cheap rejection.
The idea
Most systems set timeouts hop by hop. The gateway waits so long for the order service, the order service waits its own amount for inventory, and inventory waits on the database. Each value is chosen in isolation, and none of them knows when the original caller stopped caring.
The result is work that completes for nobody. When the gateway gives up, the services below keep going: queries run, locks are held, responses are serialized and thrown away. Under normal load this is invisible. Under stress it is the main event, because queues fill with requests whose callers have already left, real requests wait behind them, and those time out too.
Deadline propagation fixes this by attaching one budget to the request at the edge and carrying it through every hop. Each service checks the remaining time before starting work, passes a smaller budget to its dependencies, and cancels in-flight calls when the budget runs out.
An example
A checkout request enters the gateway with a fixed budget. The database behind inventory has slowed down.
Without propagation: - The gateway times out and returns an error. The client retries. - The order service is still waiting on inventory, because its own timeout is longer than the gateway's. - Inventory is still running the slow query for the first attempt. - The retry starts a second full chain, so the slow database now carries two copies of the same work, then three.
With propagation: - The gateway sends the remaining budget with the call. - The order service subtracts a small margin and gives inventory what is left. - Inventory dequeues a request whose budget has already expired and drops it without touching the database. - When the budget expires mid-query, the cancelled context reaches the driver and the query stops.
The database sees less load at exactly the moment it needs it.
Where it breaks
Absolute timestamps across machines depend on clock agreement. Skew makes a fresh request look expired, or an expired one look fresh. Sending a remaining duration and converting it to a local monotonic clock avoids this, which is how gRPC carries its timeout header.
Cancellation is only as good as the code that honors it. A cancelled context.Context does nothing if the HTTP client, driver or worker loop ignores it.
Some work must not be cut off. Aborting halfway through a multi-step write can leave state worse than finishing it. Background work triggered by a request, such as sending a receipt, should not inherit the user's deadline at all.
Budgets that are too tight turn a slow dependency into a total outage. Propagation removes waste; it does not make an unrealistic budget achievable.
In practice
- Set the deadline once, at the edge, from what the user-facing latency target actually allows.
- Pass remaining duration across process boundaries, never wall-clock time.
- Check the deadline on dequeue, before any expensive work. This is the cheapest form of load shedding available.
- Reserve a small margin per hop so a response can still travel back.
- Retry only if the remaining budget can cover another full attempt.
- Thread the context into every client and driver, and back it with server-side limits such as Postgres
statement_timeout. - Detach deliberately for work that must finish, and make that choice visible in the code.
- Emit a metric for requests completed after their deadline. I would start there, because it measures the waste directly.
A timeout protects the caller, while a propagated deadline protects everything downstream from work the caller has already abandoned.