Turn an unbounded wait into a bounded failure#
An API calling a payment service without a timeout can retain a connection, request slot, and memory indefinitely. A connection timeout bounds establishment; a request/read timeout bounds waiting for work; an end-to-end deadline bounds the user operation across nested calls.
Allocate one 500 ms deadline
40 + 100 + 200 + 60 = 400 ms
Remaining contingency = 100 msGiving every downstream call 500 ms allows a nested call to consume the entire user budget. Propagate the deadline and allocate smaller budgets with contingency; actual values should follow measured latency distributions and product requirements.
| Too short | Too long |
|---|---|
| Healthy tail requests fail; retries rise | Resources remain occupied; queues grow |
| False failure signals | Slow failures propagate upstream |
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- Timeouts, retries, and backoff with jitterAmazon Builders' Library
- Addressing cascading failuresGoogle SRE