Skip to content

Use "full jitter" & updated base delay for STANDARD retry mode defaults #2648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Bennett-Lynch
Copy link
Contributor

Motivation and Context

The STANDARD retry mode has standardized behavior across the SDKs. This
includes using "full jitter" backoff (i.e., 0-100% of the computed
delay) for both normal and throttling errors. The standard behavior also
uses a base delay of 1 second.

Modifications

  • Update BackoffStrategy's defaultStrategy and
    defaultThrottlingStrategy methods to accept a RetryMode. The
    RetryMode will be used to resolve the default jitter strategy ("full"
    vs. "equal") as well as the base delay (the max backoff time does not
    vary between modes).
  • Define additional constants in SdkDefaultRetrySetting to support the
    update base delay values. (Note: This includes backwards-incompatible
    changes but the class is annotated @SdkInternalApi.)
  • Update RetryPolicy to use the new methods.
  • Add tests to RetryPolicyTest to ensure that it is resolving to the
    correct strategy and values.
  • Add new unit test class for FullJitterBackoffStrategy. This confirms
    that full jitter is consistent with the standard retry behavior.
  • Update FullJitterBackoffStrategy to add 1 ms to the random result.
    This both allows us to reach our maximum value (since the random
    parameter is exclusive) and ensures we always have a delay of at least 1
    ms (which is consistent with BackoffStrategy.none()'s behavior).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

## Motivation and Context

The STANDARD retry mode has standardized behavior across the SDKs. This
includes using "full jitter" backoff (i.e., 0-100% of the computed
delay) for both normal and throttling errors. The standard behavior also
uses a base delay of 1 second.

## Modifications

* Update BackoffStrategy's `defaultStrategy` and
`defaultThrottlingStrategy` methods to accept a `RetryMode`. The
`RetryMode` will be used to resolve the default jitter strategy ("full"
vs. "equal") as well as the base delay (the max backoff time does not
vary between modes).
* Define additional constants in SdkDefaultRetrySetting to support the
update base delay values. (Note: This includes backwards-incompatible
changes but the class is annotated @SdkInternalApi.)
* Update RetryPolicy to use the new methods.
* Add tests to RetryPolicyTest to ensure that it is resolving to the
correct strategy and values.
* Add new unit test class for FullJitterBackoffStrategy. This confirms
that full jitter is consistent with the standard retry behavior.
* Update FullJitterBackoffStrategy to add 1 ms to the random result.
This both allows us to reach our maximum value (since the random
parameter is exclusive) and ensures we always have a delay of at least 1
 ms (which is consistent with BackoffStrategy.none()'s behavior).
@@ -0,0 +1,157 @@
package software.amazon.awssdk.core.retry.backoff;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright header

import software.amazon.awssdk.core.retry.RetryPolicyContext;

@RunWith(Parameterized.class)
public class FullJitterBackoffStrategyTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice tests!

Bennett Lynch added 2 commits August 10, 2021 10:56
## Motivation and Context

The STANDARD retry mode has standardized behavior across the SDKs. This
includes using "full jitter" backoff (i.e., 0-100% of the computed
delay) for both normal and throttling errors. The standard behavior also
uses a base delay of 1 second.

## Modifications

* Update BackoffStrategy's `defaultStrategy` and
`defaultThrottlingStrategy` methods to accept a `RetryMode`. The
`RetryMode` will be used to resolve the default jitter strategy ("full"
vs. "equal") as well as the base delay (the max backoff time does not
vary between modes).
* Define additional constants in SdkDefaultRetrySetting to support the
update base delay values. (Note: This includes backwards-incompatible
changes but the class is annotated @SdkInternalApi.)
* Update RetryPolicy to use the new methods.
* Add tests to RetryPolicyTest to ensure that it is resolving to the
correct strategy and values.
* Add new unit test class for FullJitterBackoffStrategy. This confirms
that full jitter is consistent with the standard retry behavior.
* Update FullJitterBackoffStrategy to add 1 ms to the random result.
This both allows us to reach our maximum value (since the random
parameter is exclusive) and ensures we always have a delay of at least 1
 ms (which is consistent with BackoffStrategy.none()'s behavior).
## Motivation and Context

The STANDARD retry mode has standardized behavior across the SDKs. This
includes using "full jitter" backoff (i.e., 0-100% of the computed
delay) for both normal and throttling errors. The standard behavior also
uses a base delay of 1 second.

## Modifications

* Update BackoffStrategy's `defaultStrategy` and
`defaultThrottlingStrategy` methods to accept a `RetryMode`. The
`RetryMode` will be used to resolve the default jitter strategy ("full"
vs. "equal") as well as the base delay (the max backoff time does not
vary between modes).
* Define additional constants in SdkDefaultRetrySetting to support the
update base delay values. (Note: This includes backwards-incompatible
changes but the class is annotated @SdkInternalApi.)
* Update RetryPolicy to use the new methods.
* Add tests to RetryPolicyTest to ensure that it is resolving to the
correct strategy and values.
* Add new unit test class for FullJitterBackoffStrategy. This confirms
that full jitter is consistent with the standard retry behavior.
* Update FullJitterBackoffStrategy to add 1 ms to the random result.
This both allows us to reach our maximum value (since the random
parameter is exclusive) and ensures we always have a delay of at least 1
 ms (which is consistent with BackoffStrategy.none()'s behavior).
Bennett Lynch and others added 2 commits August 10, 2021 11:32
## Motivation and Context

The STANDARD retry mode has standardized behavior across the SDKs. This
includes using "full jitter" backoff (i.e., 0-100% of the computed
delay) for both normal and throttling errors. The standard behavior also
uses a base delay of 1 second.

## Modifications

* Update BackoffStrategy's `defaultStrategy` and
`defaultThrottlingStrategy` methods to accept a `RetryMode`. The
`RetryMode` will be used to resolve the default jitter strategy ("full"
vs. "equal") as well as the base delay (the max backoff time does not
vary between modes).
* Define additional constants in SdkDefaultRetrySetting to support the
update base delay values. (Note: This includes backwards-incompatible
changes but the class is annotated @SdkInternalApi.)
* Update RetryPolicy to use the new methods.
* Add tests to RetryPolicyTest to ensure that it is resolving to the
correct strategy and values.
* Add new unit test class for FullJitterBackoffStrategy. This confirms
that full jitter is consistent with the standard retry behavior.
* Update FullJitterBackoffStrategy to add 1 ms to the random result.
This both allows us to reach our maximum value (since the random
parameter is exclusive) and ensures we always have a delay of at least 1
 ms (which is consistent with BackoffStrategy.none()'s behavior).
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

81.6% 81.6% Coverage
0.0% 0.0% Duplication

@Bennett-Lynch Bennett-Lynch merged commit 89c6d6f into aws:master Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants