Skip to content
BIASED

Resilience and capacity

Block 1 of 4~2 min

Timeouts and deadlines

Availability of a service that hard-depends on others is at most the product of their availabilities; soft dependencies and graceful degradation push back against that math. This topic is about keeping failures small when they happen. Clients that wait forever on a slow payment path hold workers, sockets and memory until upstream retries amplify load and turn a dependency blip into your outage.

Set timeouts from the dependency's latency tail, not from hope. If the dependency's p99 is 200 ms, a 10 s client timeout is not "safe" — it is permission for each stuck call to occupy a worker for 10 s. At 500 RPS with 2% of calls stuck that deep, you need on the order of 0.02×500×10=1000.02\times500\times10=100 extra concurrent workers just to hold the dead weight. Propagate deadlines (absolute deadlines or remaining time budgets) so cancelled clients stop work downstream instead of finishing useless queries after the user is gone.

Distinguish connect timeout, request timeout and total deadline. A generous connect timeout with a tight total deadline still fails fast when the network is blackholed.

Answers are saved on the server and tied to this browser until you sign in.