advanced
Timeouts
Set explicit deadlines per hop so callers stop waiting before resources pile up and upstream latency budgets are exhausted.
Timeouts stop callers from waiting indefinitely when a dependency stalls, freeing threads, connections, and user patience. In microservices, propagate deadlines contextually so each hop receives a shrinking budget rather than a fresh full timeout.
Trade-off: too-short timeouts cause false failures; too-long timeouts pile up queued work and amplify outages.
On interviews: calculate a latency budget for a 300ms p99 API with three downstream calls; explain deadline propagation in gRPC or HTTP headers.
Common pitfalls: default client timeouts everywhere; ignoring timeout on only one hop; no monitoring of timeout rate versus error rate.
Checklist:
- Derive per-hop timeouts from end-to-end SLO.
- Propagate deadline context across calls.
- Log and metric timeout cancellations.
- Align load balancer and client timeouts.