Reactor -Exponential Backoff

Numerous components on a network, such as DNS servers, switches, load balancers, and others can generate errors anywhere in the life of a given request. A common way to handle theses failures is through the use of retries, and retries with backoff and jitter.

As an engineer, your should clearly enforce these practices when dealing with network connectivity or similar communication protocols over the internet.

Retries, as mentioned previously, are a nice way for dealing with transient remote API errors in client applications. When a client receives an error response for a timeout, it is the responsibility of the client to retry.

Therefore, having a good retry mechanism is important for making our operations run smoothly.


Exponential backoff

Exponential backoff with Jitter

This is especially beneficial when using concurrent clients.

Reactor - RetryBackoffSpec

RetryBackoffSpec is Retry strategy based on exponential backoffs with jitter.

The client blocks for a brief initial wait time on the first failure, but as the operation continues to fail, it waits proportionally to 2^n, where n is the number of failures that have occurred, a well choosen amount of random jitter is added to each client’s wait time.


I will refer to jitterOffset as j.

jitterOffset is obtained by multiplying the jitterFactor (default =0.5) and the computed delay , it defines the interval from which we will pick the jitter.

The delay is calculated as the following:

For each retry the minBackoff is multiplied by 2^n, where n is the number of failures that have occurred and we check if maxBackoff has not been hit.

the next delay would be

where minimum is the usual minimum function, max and min are the maxBackOff and minBackOff respectively.

so far it’s an Exponential backoff, as discussed earlier we want to add some randomness,


where j is the jitterOffset.

but we have to ensure that the nextBackoff is in the correct interval, which means

but we have also that

this leads us to define epsilon as

this explains this part of the code:

If the retry requests fails after exceeding the max, an error is reported:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store