Repository navigation
Announcement: Updated default retry behavior (2026) #6984
Replies: 2 comments 2 replies
|
How much jitter is used? For example, if the base delay is 1000ms is the real delay value going to be 900-1100ms or will it be 0 to 2000ms? And assuming it's "full jitter" as https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html seems to say, then what's to keep all retries from being completed in 5ms total and a very transient issue causing an unnecessary exception? |
Update: The updated retry behavior is now the defaultStarting in What this means for you
Restoring previous behavior In export AWS_RETRY_MODE=legacyThis also restores DynamoDB's previous defaults. See How to revert in the description for other ways to set it, including for DynamoDB clients configured in code. We've updated the description with the new version information and revert instructions, and corrected some of the before-and-after values. If you run into unexpected behavior, comment here. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Important
Update: Starting in
software.amazon.awssdk:*version2.58.0(released November 11, 2026), the updated retry behavior is the default and theAWS_NEW_RETRIES_2026environment variable is removed. To test the updated behavior before you upgrade, see How to opt in early. To restore the previous default behavior after you upgrade, see How to revert.Status
software.amazon.awssdk:*version2.44.2and laterAWS_NEW_RETRIES_2026=true(removed in version2.58.0)software.amazon.awssdk:*version2.58.0and later (released November 11, 2026)What changed
Starting in version
2.58.0(or earlier, if you setAWS_NEW_RETRIES_2026=true), the default retry mode changes fromlegacytostandard. Several other retry defaults also update. Thestandardmode replaceslegacy's retry quota with one that has higher token costs. The quota limits retries when failures are widespread, so your application fails fast instead of waiting on retries that are unlikely to succeed. This also helps service disruptions resolve faster by reducing retry traffic.If you set max attempts with
AWS_MAX_ATTEMPTS, theaws.maxAttemptssystem property, ormax_attemptsin your config file, your value takes precedence, including for DynamoDB clients. Inlegacymode, the SDK ignoresmax_attemptsin your config file, and DynamoDB clients ignore all three. The new backoff timing, retry quota costs, and retryable errors also apply to retry strategies that you configure in code, such asretryStrategy(RetryMode.STANDARD),AwsRetryStrategy.standardRetryStrategy(), andretryStrategy(b -> b.maxAttempts(5))(unless your environment or config file setslegacy). To keep the updated behavior with a custom value, see Overriding specific settings.legacystandardLimitExceededExceptionIdpCommunicationErrorExceptionTransient errors (such as 500s and connection resets) now use a much shorter backoff than throttling errors (where the service asks you to slow down). For details on backoff timing, error classification, and the retry quota, see Retry behavior in the AWS SDKs. For retry mode selection and configuration options, see Retry behavior in the AWS SDKs.
How to opt in early
Update to
software.amazon.awssdk:*version2.44.2or later, then set the environment variable:export AWS_NEW_RETRIES_2026=trueYou can also set it as a JVM system property:
The opt-in doesn't include some changes that ship with
2.58.0:standardandadaptiveretry strategies configured in code also use the updated behavior, DynamoDB clients honorAWS_MAX_ATTEMPTSandmax_attempts, clients readmax_attemptsfrom their own configured profile, Kinesis clients use the updated behavior, andadaptivemode backs off before failing long-polling operations and limits thex-amz-retry-afterdelay.In version
2.58.0and later, the updated behavior is the default and the SDK ignoresAWS_NEW_RETRIES_2026andaws.newRetries2026. If either is set to a value other thantrue, the SDK logs a warning. You can remove them from your configuration after you upgrade.How to revert
In versions earlier than
2.58.0, remove the environment variable:unset AWS_NEW_RETRIES_2026In version
2.58.0and later, the updated behavior is the default and the SDK ignoresAWS_NEW_RETRIES_2026, so unsetting it or setting it tofalsedoesn't restore the previous behavior. To restore the previous default behavior, set the retry mode tolegacy:export AWS_RETRY_MODE=legacyYou can also use the
-Daws.retryMode=legacyJVM system property orretry_mode = legacyin your config file. Or in code:Setting
legacywithAWS_RETRY_MODE,aws.retryMode, or your config file restores the previous default behavior, including DynamoDB's 9 max attempts and 25 ms base delay.If you set
RetryMode.LEGACYin code on a DynamoDB client, the client gets the generallegacyvalues (4 max attempts and a 100 ms base delay), as in previous versions. To restore DynamoDB's previous behavior in code:Setting the retry mode to
legacyrestores the previous default only. If you explicitly setstandardoradaptivemode before, you can't restore that mode's previous retry quota cost (5 tokens per retry). You can set its previous base delay (100 ms) withbackoffStrategyin code, as shown in Overriding specific settings.Where you might notice a difference
Transient errors recover faster because the base delay is significantly shorter, except for DynamoDB clients, whose transient base delay is unchanged.
AWS_MAX_ATTEMPTS, theaws.maxAttemptssystem property, ormax_attemptsin your config file. These apply one value to all clients. To set it for one client, see Overriding specific settings.legacymode already had a 500-token retry quota, which charged 5 tokens per transient retry and nothing for throttling retries.standardmode charges 14 tokens per transient retry and 5 tokens per throttling retry. For details, see retry quota.standardandadaptivemode, operations likeSQS.ReceiveMessageapply a backoff delay before returning an error, even when retries are blocked. Without this, a polling loop would send its next request immediately after each error, spiking client CPU usage and generating additional traffic. For details, see long-polling operations.x-amz-retry-afterresponse header. When a service sends it, the SDK waits at least its own computed backoff and at most 5 seconds longer. Instandardandadaptivemode, synchronous clients no longer use theRetry-Afterheader.RetryPolicywithout a retry mode usesstandardmode. If you configure aRetryPolicy(deprecated) without a retry mode, for exampleAwsRetryPolicy.defaultRetryPolicy(), it now uses the previousstandardmode values (3 max attempts and a 100 ms base delay) instead oflegacy's. ARetryPolicydoesn't use the updated behavior.2.58.0doesn't get all of these changes when used with newer core modules. For example, an older DynamoDB module usesstandardmode with its previous values and 9 max attempts. Use the same version for everysoftware.amazon.awssdkmodule, for example with the BOM (software.amazon.awssdk:bom).Overriding specific settings
You do not have to accept all changes as a bundle. If you want to keep a specific previous value for the retry mode, max attempts, backoff, or throttling backoff, set it explicitly. You can't set retry quota costs. Precedence between environment variables and your config file applies per setting. A retry strategy object that you set in code replaces all defaults, including DynamoDB's, except the SDK's default retryable-error conditions, which the client adds unless you call
useClientDefaults(false).For example, to use the new backoff timing but keep a higher DynamoDB max attempts:
On a DynamoDB client,
o.retryStrategy(b -> b.maxAttempts(9))keeps the updated behavior but starts from the general defaults, so it uses a 50 ms base delay instead of DynamoDB's 25 ms.Kinesis clients don't retry
SubscribeToShardby default, but a retry mode or retry strategy that you set in code on a Kinesis client, including in a plugin, also retriesSubscribeToShard, as in previous versions. To change max attempts for other Kinesis operations without retryingSubscribeToShard, useAWS_MAX_ATTEMPTS,aws.maxAttempts, ormax_attemptsin your config file.For the full list of configurable settings and their precedence, see Retry behavior in the AWS SDKs.
Feedback
If you encounter unexpected behavior or have questions, comment on this issue. If you need a previous value that you can't configure, let us know here.
All reactions