[Melbourne-pm] Retry/Attempt

Daniel Pittman daniel at rimspace.net
Mon May 17 22:26:56 PDT 2010


Sam Watkins <sam at nipl.net> writes:
> On Tue, May 18, 2010 at 11:16:12AM +1000, Daniel Pittman wrote:
>> > I'm jealous, a genuine opportunity to use Fibonacci in a real-world program!
>> 
>> Heh.  Despite my bikeshedding ^W encouragement, this just doubles the delay
>> every time, rather than using a Fibonacci back-off strategy.  Alas. :)
>
> What advantage would there be to using Fibonacci numbers instead of
> exponential backoff?

It retries faster in the early stages, and grows a little less quickly, so
tends to give better recovery faster than you would otherwise see.

> IIRC the Fibonacci series is approximately exponential anyway.

Er, no, not really.  Exponential grows enormously more quickly than Fibonacci
does; starting at 1, at 10 steps you have 34 vs 256, at 15 steps 377 vs 8192.

> I use exponential growth and backoff for several things, e.g. my sshd, and
> to grow storage for buffers and vectors (dynamically sized arrays).

Depending on your needs either might be appropriate; Fibonacci is much better
when you want something to retry fairly frequently, or to grow only by smaller
steps.

        Daniel
-- 
✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons


More information about the Melbourne-pm mailing list