Skip to content
Snippets Groups Projects
Commit 0e5d2efc authored by David Klempner's avatar David Klempner
Browse files

Update the connection backoff document with jitter.

This adds both jitter and explicit values for the "proposed" algorithm
that implementations should use.
parent 22b50c93
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ We have several parameters:
## Proposed Backoff Algorithm
Exponentially back off the start time of connection attempts up to a limit of
MAX_BACKOFF.
MAX_BACKOFF, with jitter.
```
ConnectWithBackoff()
......@@ -24,9 +24,25 @@ ConnectWithBackoff()
!= SUCCESS)
SleepUntil(current_deadline)
current_backoff = Min(current_backoff * MULTIPLIER, MAX_BACKOFF)
current_deadline = now() + current_backoff
current_deadline = now() + current_backoff +
UniformRandom(-JITTER * backoff, JITTER * backoff)
```
With specific parameters of
INITIAL_BACKOFF = 20 seconds
MULTIPLIER = 1.6
MAX_BACKOFF = 120 seconds
JITTER = 0.2
Implementations with pressing concerns (such as minimizing the number of wakeups
on a mobile phone) may wish to use a different algorithm, and in particular
different jitter logic.
Alternate implementations must ensure that connection backoffs started at the
same time disperse, and must not attempt connections substantially more often
than the above algorithm.
## Historical Algorithm in Stubby
Exponentially increase up to a limit of MAX_BACKOFF the intervals between
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment