linear
or exponential backoff
retry strategy.
Linear Retry
Exponential Backoff
Exponential Backoff with capped duration
Strategy | Formula |
---|---|
Linear Retry | + 1 hour |
Exponential Backoff | (delaySeconds * 2^attempt) + jitter |
Exponential Backoff with Capped Duration | min(delaySeconds * 2^attempt, maxRetrySeconds) + jitter |
delaySeconds * 2^attempt
delaySeconds * 2^attempt
).maxRetrySeconds
) to prevent indefinitely long wait times, thus ensuring the system remains responsive and efficient.jitter
value is added to each calculated wait time, providing an additional layer of randomness that further helps distribute the retry attempts over time.A graph comparing the cumulative retry duration for two retry strategies
Linear Retry | Exponential Backoff with Capped Duration | |
---|---|---|
Requirement 1 The first 5 retries should happen in less than 30 minutes | The graph shows that the linear retry strategy takes about 18,000 seconds by the 5th retry. 18,000 seconds is approximately 5 hours, which exceeds the 30-minute limit for the first 5 retries. | The graph shows that the capped duration strategy takes about 601 seconds by the 5th retry. 601 seconds is approximately 10 minutes and 1 second, which doesn’t exceed the 30-minute limit for the first 5 retries. |
Requirement 2 The maximum retry should happen not greater than 24 hours | By the 20th retry attempt, the linear strategy takes about 72,000 seconds, which translates to 20 hours, which doesn’t exceed the 24 hours rule. | By the 20th retry attempt the capped duration strategy takes about 89559 seconds, which translates to 24 hours 52 minutes which slightly exceeds the 24 hours rule. |
An additional graph includes exponential backoff.