Timeouts
Every network dependency should have an intentional timeout.
Without timeouts, a slow dependency can consume application threads, event-loop resources, connection pools, and memory until the entire service becomes unavailable.
Timeouts should reflect realistic service-level expectations rather than being arbitrarily large.
Different timeout categories can exist for connection establishment, request headers, response body, database operations, and total request duration.
Key Takeaways
- No network call should wait forever.
- Timeouts prevent resource exhaustion.
- Timeout values should be based on measured service expectations.