From e00b0c3247e94fa98ae8e00641598853caedcd1c Mon Sep 17 00:00:00 2001 From: David Klempner Date: Mon, 13 Jul 2015 18:02:06 -0700 Subject: Add description of MIN_CONNECT_TIMEOUT and fix its pseudocode usage. --- doc/connection-backoff.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'doc/connection-backoff.md') diff --git a/doc/connection-backoff.md b/doc/connection-backoff.md index 70abc980f0..7094e737c5 100644 --- a/doc/connection-backoff.md +++ b/doc/connection-backoff.md @@ -8,8 +8,9 @@ requests) and instead do some form of exponential backoff. We have several parameters: 1. INITIAL_BACKOFF (how long to wait after the first failure before retrying) 2. MULTIPLIER (factor with which to multiply backoff after a failed retry) - 3. MAX_BACKOFF (Upper bound on backoff) - 4. MIN_CONNECTION_TIMEOUT + 3. MAX_BACKOFF (upper bound on backoff) + 4. MIN_CONNECT_TIMEOUT (minimum time we're willing to give a connection to + complete) ## Proposed Backoff Algorithm @@ -20,7 +21,7 @@ MAX_BACKOFF, with jitter. ConnectWithBackoff() current_backoff = INITIAL_BACKOFF current_deadline = now() + INITIAL_BACKOFF - while (TryConnect(Max(current_deadline, MIN_CONNECT_TIMEOUT)) + while (TryConnect(Max(current_deadline, now() + MIN_CONNECT_TIMEOUT)) != SUCCESS) SleepUntil(current_deadline) current_backoff = Min(current_backoff * MULTIPLIER, MAX_BACKOFF) -- cgit v1.2.3