All Products
Search
Document Center

Microservices Engine:Configure a retry policy

Last Updated:Mar 11, 2026

Transient failures -- momentary network issues, temporary service overloads, connection resets -- can cause individual requests to fail even when backend services are healthy. A retry policy on your cloud-native gateway automatically resends failed requests, so your application recovers without client-side changes. Configure retry policies at the route level in Microservices Engine (MSE).

Important

Retries increase the total number of requests to backend services. Set retry limits conservatively (0, 1, or 2) to avoid overwhelming an already-degraded service.

How it works

When a request matches a retry condition, the gateway resends the request up to the configured number of times.

Default behavior (no custom policy): The gateway retries failed requests up to 2 times using these conditions: connect-failure, refused-stream, unavailable, cancelled, and retriable-status-codes. This default applies even when a custom retry policy is disabled.

Important

Disabling a custom retry policy does not stop all retries. The gateway falls back to the default behavior described above. To stop retries entirely, enable a custom policy and set Retry Times to 0.

Retry conditions

The gateway supports separate retry conditions for HTTP and gRPC traffic.

HTTP retry conditions

ConditionTriggers a retry when...
5xxThe backend returns any 5xx status code, or a disconnect, reset, or read timeout occurs. This is a superset that includes connect-failure and refused-stream.
resetA disconnect, reset, or read timeout occurs (no response from the backend).
connect-failureThe request failed due to a disconnection.
refused-streamThe backend returns the REFUSED_STREAM error code.
retriable-status-codesThe backend returns one of the status codes specified in Retry Status Code.
Note

Specify status codes in Retry Status Code only when retriable-status-codes is selected as a retry condition.

gRPC retry conditions

ConditiongRPC status codeTypical cause
cancelledCANCELLED (1)The caller cancelled the operation.
deadline-exceededDEADLINE_EXCEEDED (4)The operation timed out.
internalINTERNAL (13)An internal server error occurred.
resource-exhaustedRESOURCE_EXHAUSTED (8)A resource limit was reached (for example, rate limiting).
unavailableUNAVAILABLE (14)The service is temporarily unavailable.

Recommended conditions by traffic type

Traffic typeRecommended conditionsUse case
HTTP5xxGeneral-purpose retry for server errors and connection issues. Covers connect-failure and refused-stream.
HTTPconnect-failure, refused-streamRetry only on connection-level failures, not on 5xx responses.
HTTPretriable-status-codesRetry on specific status codes such as 429 (rate limited) or 503 (service unavailable).
gRPCcancelled, unavailableStandard retry pair for gRPC services.

Prerequisites

Before you begin, make sure that you have:

  • A cloud-native gateway created in MSE

  • At least one route configured on the gateway

Configure the retry policy

  1. Log on to the MSE console. In the top navigation bar, select a region.

  2. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. Click the name of the gateway.

  3. In the left-side navigation pane, click Routes, and then click the Routes tab.

  4. Find the route to modify and click Policies in the Actions column.

  5. Click the Retry tab.

  6. Configure the following parameters and click OK.

    ParameterDescription
    Retry TimesMaximum number of retry attempts. Valid values: 0 to 10. Recommended: 0, 1, or 2. A value of 0 disables retries entirely.
    Retry ConditionOne or more conditions that trigger a retry. See Retry conditions.
    Retry Status CodeOne or more HTTP status codes that trigger a retry. Takes effect only when retriable-status-codes is selected for Retry Condition.
    EnableTurn on the switch to activate the retry policy. Turn off the switch to deactivate it.

Verify the retry policy

After you enable the retry policy, verify that it works as expected:

  1. Simulate a backend failure that matches your configured retry condition (for example, return a 503 response or drop the connection).

  2. Send a request through the gateway to the affected route.

  3. Check backend access logs to confirm the gateway retried the request the expected number of times.

Idempotency and retry storms

Idempotency: Enable retries only for idempotent operations -- requests that produce the same result when repeated. Retrying non-idempotent operations such as payment submissions can cause duplicate side effects.

Retry storms: In high-traffic scenarios, aggressive retry settings can amplify load on degraded backend services. Combine retry policies with circuit breaker or rate limiting policies to protect backend services.

Related operations