MuleSoft Timeouts: Design the Whole Timeout Budget
Setting a connector timeout is easy. Designing a reliable timeout strategy is not.
Consider this path:
Client -> Experience API -> Process API -> System API -> SaaS endpoint
If every layer independently waits 30 seconds, the caller may give up long before the deepest operation stops.
Think in Budgets
Start with the maximum response time the consumer can tolerate.
Client budget: 10 seconds
Then allocate that budget across the path, leaving room for network overhead and error handling.
Experience API 10s outer budget
Process API 8s remaining
System dependency 5s operation budget
These numbers are illustrative, not universal defaults.
Retries Consume the Same Budget
Three attempts with a five-second timeout can already exceed a ten-second caller budget.
attempt 1: 5s
wait: 1s
attempt 2: 5s
----------------
11s before attempt 2 finishes
Retry policy and timeout policy must therefore be designed together.
Make Outer Layers Stop Later Than Inner Layers
Generally, an inner dependency timeout should occur before the outer request expires. That gives the integration time to classify the failure and return a controlled response instead of having the caller disappear first.
Long Work May Need Asynchrony
If the business operation legitimately takes longer than the synchronous budget, increasing every timeout may be the wrong solution.
Consider:
POST /jobs -> 202 Accepted + jobId
|
v
async processing
The caller can query status or receive a completion event later.
Final Principle
Do not ask only, What should this connector timeout be? Ask, What is the end-to-end latency budget, and how much of it can this dependency consume?