aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.16k stars 840 forks source link

Add ExponentialDelayWithHalfJitter backoff strategy #5333

Closed sugmanue closed 3 months ago

sugmanue commented 3 months ago

Motivation and Context

Introducing a new backoff strategy that is used in the LegacyRetryStrategy for backing off for throttling exceptions.

This change mimics the previous behavior in which the EqualJitterBackoffStrategy was used as the throttling backoff strategy for RetryMode.LEGACY. See here and here.

This backoff strategy differs from the full jitter exponential strategy on a cap used for the minimum delay time. The full jitter exponential backoff strategy waits in the range

[ 0, exponential-delay ]

whereas this one waits in the range

[ exponential-delay / 2, exponential-delay ]

The idea being since we are retrying after a throttling exception we want to wait some amount that is not or close to zero.

Modifications

Testing

Screenshots (if appropriate)

Types of changes

Checklist

License

sonarcloud[bot] commented 3 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
66.7% Coverage on New Code (required ≥ 80%)
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint