← Back to microservices patterns map
Lesson 29 · Reliability Patterns
Timeout Pattern
Never wait forever for an outgoing call.
timeout
Detailed Description
Timeouts cap how long resources are tied up waiting for dependencies.
Set timeouts based on real latency data and overall request budget.
Visual Diagram
Timeout Configuration
connect_timeout: 2s (TCP handshake)
request_timeout: 5s (full response)
read_timeout: 3s (each read chunk)
ServiceA → calls ServiceB
→ no response in 5s
→ TimeoutException thrown
→ return fallback / 503
Without timeout: thread hangs foreverTradeoffs
Pros
Predictable behavior, frees stuck work
Cons
Too short causes false failures
Examples: fetch AbortController, axios timeout, gRPC deadline
Comments
Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.
Loading comments...
On this page
0 sections