[FEATURE REQ] RetryPolicy / RetryOptions - configurable exponent & random boundaries and/or custom retry mode (user provided CalculateExponentialDelay)
See original GitHub issueLibrary name
Azure.Core
Please describe the feature.
Consider the existing method for calculating exponential backoff delay: https://github.com/Azure/azure-sdk-for-net/blob/4d8a0979d83ffd6f52e97b3eeeab28858f50ccba/sdk/core/Azure.Core/src/Pipeline/RetryPolicy.cs#L331
As you can see, the following are hard-coded:
- Exponent
1 <<
basically meansMath.Pow(2, attempt - 1)
(so it’s set to2
) - Lower random boundary (
0.8
) - Upper random boundary (
1.2
)
The exponent especially can be critical to the resulting delay time series, but since exposing all the above seems very simple (basically add 3 properties to RetryOptions
), might as well add them too.
In addition, a RetryMode.Custom
could be added which allows setting a custom-provided CalculateExponentialDelay
. I suppose if we have this kind of extensibility then parametrizing the above properties won’t be strictly needed, but IMHO it would be nice to have all the same (e.g. the Azure.Core team might improve the method yet retain the constants used, for example guard better against overflow).
Issue Analytics
- State:
- Created 7 months ago
- Comments:15 (10 by maintainers)
Top GitHub Comments
Updated sample in https://github.com/Azure/azure-sdk-for-net/pull/35654
Ah my bad - you were referring to the exponent factor not the jitter factor. For that, you would need to define your own custom strategy as well.