Proto: retry_timeout_policy.proto

Package: resilience.policy.gloo.solo.io

Reduce transient failures and hanging systems by setting retries and timeouts.

Retries: A retry specifies the maximum number of times an Envoy proxy attempts to connect to a service if the initial call fails. Retries can enhance service availability and application performance by making sure that calls don’t fail permanently because of transient problems, such as a temporarily overloaded service or network. The interval between retries (25ms+) is variable and determined automatically by Istio to prevent the called service from being overwhelmed with requests. The default retry behavior for HTTP requests is to retry twice before returning the error.

Like timeouts, Istio’s default retry behavior might not suit your application needs in terms of latency or availability. For example, too many retries to a failed service can slow things down. Also like timeouts, you can adjust your retry settings on a per-route basis. For more information, see the Istio documentation.

Timeouts: A timeout is the amount of time that an Envoy proxy waits for replies from a service, ensuring that services don’t hang around waiting for replies forever. This allows calls to succeed or fail within a predictable timeframe. By default, the Envoy timeout for HTTP requests is disabled in Istio. For some applications and services, Istio’s default timeout might not be appropriate. 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.

To find and use your optimal timeout settings, you can set timeouts dynamically per route. For more information, see the Istio documentation.

Examples

Retry only:

  apiVersion: resilience.policy.gloo.solo.io/v2
kind: RetryTimeoutPolicy
metadata:
  name: retry-only
  namespace: bookinfo
  annotations:
    cluster.solo.io/cluster: $REMOTE_CLUSTER1
spec:
  applyToRoutes:
    - route:
        labels:
          route: ratings # matches on route table route's labels
  config:
    retries:
      attempts: 5 # optional (default is 2)
      perTryTimeout: 2s
      # retryOn specifies the conditions under which retry takes place.
      # One or more policies can be specified using a ‘,’ delimited list.
      retryOn: "connect-failure,refused-stream,unavailable,cancelled,retriable-status-codes"
      # retryRemoteLocalities specifies whether the retries should retry to other localities, will default to false
      retryRemoteLocalities: true
  

Timeout:

  apiVersion: resilience.policy.gloo.solo.io/v2
kind: RetryTimeoutPolicy
metadata:
  name: retry-timeout
  namespace: bookinfo
  annotations:
    cluster.solo.io/cluster: $REMOTE_CLUSTER1
spec:
  applyToRoutes:
    - route:
        labels:
          route: ratings # matches on route table route's labels
  config:
    requestTimeout: 2s
  

RetryTimeoutPolicyReport

FieldDescription
workspaces(repeated RetryTimeoutPolicyReport.WorkspacesEntry)

A list of workspaces in which the policy can apply to workloads.
selectedRoutes(repeated common.gloo.solo.io.RouteReference)

A list of references to all routes selected by the policy.

RetryTimeoutPolicyReport.WorkspacesEntry

FieldDescription
key(string)

value(common.gloo.solo.io.Report)

RetryTimeoutPolicySpec

RetryTimeoutPolicy is used to add automatic retries and timeouts to requests matching selected routes. RetryTimeoutPolicies are applied at the Route level.

FieldDescription
applyToRoutes(repeated common.gloo.solo.io.RouteSelector)

Routes to apply the policy to. If empty, the policy applies to all workloads in the workspace.
config(RetryTimeoutPolicySpec.Config)

The details of the retry/timeout policy to apply to the selected routes.

RetryTimeoutPolicySpec.Config

FieldDescription
retries(RetryTimeoutPolicySpec.Config.RetryPolicy)

Set a retry policy on requests matched on the selected routes.
requestTimeout(google.protobuf.Duration)

Set a timeout on requests matched on the selected routes. For information about the value format, see the Google protocol buffer documentation.

RetryTimeoutPolicySpec.Config.RetryPolicy

Specify retries for failed requests.

FieldDescription
attempts(google.protobuf.Int32Value)

Number of retries for a given request The interval between retries will be determined automatically (25ms+). When request timeout of the HTTP route or per_try_timeout is configured, the actual number of retries attempted also depends on the specified request timeout and per_try_timeout values. Defaults to 2 retries. For information about the value format, see the Google protocol buffer documentation.
perTryTimeout(google.protobuf.Duration)

Timeout per retry attempt for a given request. Format: 1h/1m/1s/1ms. Must be >= 1ms. Default is same value as request timeout of the HTTP route, which means no timeout. For information about the value format, see the Google protocol buffer documentation.
retryOn(string)

Specifies the conditions under which retry takes place. One or more policies can be specified using a ‘,’ delimited list. If retry_on specifies a valid HTTP status, it will be added to retriable_status_codes retry policy. See the retry policies and gRPC retry policies for more details.
retryRemoteLocalities(google.protobuf.BoolValue)

Flag to specify whether the retries should retry to other localities. See the retry plugin configuration for more details. Defaults to false.

RetryTimeoutPolicyStatus

The status of the policy after it is applied to your Gloo environment.

FieldDescription
common(common.gloo.solo.io.Status)

The state and workspace conditions of the applied resource.
numSelectedRoutes(uint32)

The number of routes selected by the policy.