Skip to main content

Timeouts and Retries

Configure timeouts and retries to handle transient failures and keep service communication reliable. Both live in the Backend Traffic Policy section of the Traffic tab in the route builder.

Timeouts​

Enable Timeouts and set the durations you need. Durations use a number plus a unit, for example 500ms, 5s, 1m, or 1h.

SettingDescription
Connect TimeoutTime to establish a TCP connection to the backend
Request TimeoutTotal time to process the request and return a response
Connection Idle TimeoutTime a connection can be idle before being closed
Max Connection DurationMaximum lifetime of a connection regardless of activity
Max Stream DurationMaximum duration of a single HTTP/2 or gRPC stream

Retries​

Enable Retries and set the Number of Retries (defaults to 2). Under HTTP Status Codes, list the response codes that should be retried, for example 500, 502, 503. Under Retry On, select the trigger conditions.

Retry Conditions​

ConditionDescription
5xxRetry on any 5xx response code
Gateway ErrorRetry on 502, 503, or 504 response codes
Connection FailureRetry when the connection to the backend fails
Retriable Status CodesRetry when the response matches the configured HTTP status codes
Connection ResetRetry when the connection is reset by the backend
Reset Before RequestRetry when the connection is reset before the request is sent
Retriable 4xxRetry on retriable 4xx response codes, such as 409

Best Practices​

  • Keep the per-attempt timeout shorter than the total request timeout
  • Use exponential backoff (handled automatically)
  • Limit retries for non-idempotent requests
  • Combine with circuit breakers to prevent cascade failures

The REST API equivalent is documented in the API Reference.