A timeout is the amount of time (duration) that the gateway waits for replies from a backend service before the service is considered unavailable. This setting can be useful to avoid your apps from hanging or to fail if no response is returned in a specific timeframe. With timeouts, calls either succeed or fail within a predictable timeframe.

The time an app needs to process a request can vary a lot. For this reason, applying the same timeout across services can cause a variety of issues. For example, a timeout that is too long can result in excessive latency from waiting for replies from failing services. On the other hand, a timeout that is too short can result in calls failing unnecessarily while waiting for an operation that needs responses from multiple services.

Configuration options

You can configure different types of timeouts by using a Kubernetes Gateway API-native configuration, HTTPListenerPolicy, or a GlooTrafficPolicy as shown in the following table.

Type of timeoutDescriptionConfigured viaAttach to
Request timeoutRequest timeouts configure the time Envoy allows for the entire request stream to be received from the client.
  • HTTPRoute
  • GlooTrafficPolicy
  • HTTPRoute
  • HTTPRoute rule
Idle timeoutAn idle timeout is the time when Envoy terminates the connection to a downstream or upstream service if there no active streams.HTTPListenerPolicyGateway
Idle stream timeoutAn idle stream timeout is the time Envoy allows a stream to exist without activity before it is terminated.GlooTrafficPolicy
  • HTTPRoute
  • HTTPRoute rule
Per-try timeoutSet a shorter timeout for retries than the overall request timeout.
  • HTTPRoute
  • GlooTrafficPolicy
  • HTTPRoute
  • HTTPRoute rule
  • Gateway listener (GlooTrafficPolicy only)