Repository navigation
Announcement: Updated default retry behavior (2026) #1885
Pinned
luigi617
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Note
Update: The other AWS SDKs made the updated retry behavior the default on November 10, 2026. The AWS SDK for Kotlin will make it the default, and remove
AWS_NEW_RETRIES_2026, in its next minor version, which follows the next Kotlin language release and is expected in December 2026 or January 2027. Until then, you can opt in. Version 1.8.0, which this post previously named, shipped without the change.We're updating the standard retry strategy in the AWS SDK for Kotlin and the underlying smithy-kotlin runtime to the updated retry behavior that the AWS SDKs share. The update refines backoff timing, adds service-specific tuning for DynamoDB, and improves handling of long-polling operations. Its retry quota lets your application fail fast when failures are widespread, and helps service disruptions resolve faster by reducing retry traffic.
With the opt-in off, the retry defaults are the values in the Before column below. Since 1.6.73, throttling retries use a 1,000 ms base delay and the SDK honors the
x-amz-retry-afterheader, with or without the opt-in. The new standard retry has been available to opt in since release 1.6.73 (05/13/2026). Use 1.9.0 or later for the complete behavior: before 1.9.0, opting in withAWS_NEW_RETRIES_2026alone charged transient retries 5 tokens instead of 14. It will become the default in the SDK's next minor version, expected in December 2026 or January 2027.Status
aws-sdk-kotlinversion1.9.0and later (introduced in1.6.73)AWS_NEW_RETRIES_2026=trueWhat changed
When you set
AWS_NEW_RETRIES_2026=true, the retry defaults withinstandardmode update. The retry mode itself does not change.If you have explicitly configured max attempts or backoff, your value takes precedence for that setting.
Backoff timing
The retry delay for a given attempt is calculated as:
Where
attemptNumberis 0-indexed (the first retry usesattemptNumber = 0) andmaxBackoffis 20 seconds (unchanged).Transient errors (such as 500s and connection resets) use a much shorter backoff than throttling errors (where the service asks you to slow down), with a 50 ms base delay instead of 1,000 ms. 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.
Retry header:
x-amz-retry-afterThe SDK honors the
x-amz-retry-afterresponse header (with or without the opt-in), which allows services to recommend a specific backoff duration in milliseconds. The SDK will never wait less than its own calculated backoff, and never more than 5 seconds beyond it.How to opt in
Update to
aws-sdk-kotlinversion1.9.0or later, then set the environment variable:export AWS_NEW_RETRIES_2026=trueYou can also set it as a JVM system property:
The flag applies to clients created with
fromEnvironment. Clients created withDynamoDbClient { ... }, and retry strategy instances that you create yourself, follow onlySMITHY_NEW_RETRIES_2026. Only the valuetrue(in any case) enables the updated behavior, and a JVM system property takes precedence over its environment variable.smithy-kotlin
For smithy-kotlin users not using the AWS SDK, the equivalent flag is:
export SMITHY_NEW_RETRIES_2026=trueOr as a JVM system property:
AWS_NEW_RETRIES_2026takes precedence for the SDK-level changes (DynamoDB defaults and long-polling backoff): when it's set,SMITHY_NEW_RETRIES_2026is ignored for those. The smithy-kotlin defaults (base delays, scale factor, and token costs) are enabled when either variable istrue.For clients created with
fromEnvironment:AWS_NEW_RETRIES_2026SMITHY_NEW_RETRIES_2026truefalsetruefalsefalseor unsettruefalseor unsetClients created with
DynamoDbClient { ... }ignoreAWS_NEW_RETRIES_2026. WithSMITHY_NEW_RETRIES_2026=true, they get the updated smithy-kotlin defaults (base delay, scale factor, and token costs), but never the DynamoDB defaults or the long-polling backoff.How to revert
During the opt-in period, remove
AWS_NEW_RETRIES_2026, and also-Daws.newRetries2026,SMITHY_NEW_RETRIES_2026, or-Dsmithy.newRetries2026if you set them:unset AWS_NEW_RETRIES_2026When the updated behavior becomes the default, the
AWS_NEW_RETRIES_2026flag will be removed, and we'll update this section. While you're opted in,legacyretry mode doesn't turn the updated behavior off: the SDK treatslegacythe same asstandard. You can override individual settings in code:AWS_MAX_ATTEMPTSor configure in code.throttlingBaseDelay) with or without the opt-in. SetthrottlingBaseDelayin code to change it.tokenBucket { useNewRetries = false; retryCost = 5; timeoutRetryCost = 10 }.If this is a concern for your use case, please let us know in this issue.
Where you might notice a difference
Transient retries wait longer than before (50 ms base delay instead of 10 ms), but far less than throttling retries (1,000 ms).
SQS.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.Overriding specific settings
You do not have to accept all changes as a bundle. If you opt in but want to keep a specific previous value, set it explicitly. Precedence applies per setting when you use the
retryStrategy { }block, as in the example below. Assigning a strategy instance, such asretryStrategy = StandardRetryStrategy { }, replaces every default.For example, to use the new backoff timing but keep a higher DynamoDB max attempts:
For the full list of configurable settings and their precedence, see Retry behavior in the AWS SDKs.
Feedback
If you run into any issues or have questions, please open an issue in aws-sdk-kotlin or comment on this discussion. Your feedback during the opt-in period directly shapes when and how we make this the default.
All reactions