I observed that the delays when using exponential backoff seems rather odd to me as it seems to be returning results that are too high. For example, the ff. will be the delays for 10 attempts given that the initial delay is 2000 milliseconds (with the value in the parenthesis as the total delay).
Introduction
I observed that the delays when using exponential backoff seems rather odd to me as it seems to be returning results that are too high. For example, the ff. will be the delays for 10 attempts given that the initial delay is 2000 milliseconds (with the value in the parenthesis as the total delay).
File used to generate results: https://gist.github.com/jkcdarunday/6b6ea98718e8c3bab1ee909e4033482d
Results
Observations
It jumped significantly from 10m10s in Attempt 6 to 5h20m in Attempt 7. This goes further to Attempt 8 where it suddenly became a 14 day delay.
Expectation
Increase in delay per attempt should only be around 2-3 times. i.e. 5h to 10h, not 5h to 14 days.
Thoughts
I think the function did not put into consideration that the delay value is updated every time with the result of the backoff function and expected that the delay would always be the initial delay. This results in the delay being multiplied by 2 then by 4 then by 8 then by 16 which builds up quickly.
I believe that if we leave the delay as always 2000 in the example above, we'll get more plausible results.
Doing so, we get the following which looks closer to exponential growth: