Skip to main content
Version: v2.0 (latest)

Exponential Backoff

Exponential backoff is a widely utilized technique where the delay duration increases exponentially after each failed attempt. For instance, an initial delay of 1 second might be doubled to 2 seconds after the first failed attempt, then quadrupled to 4 seconds after the second failed attempt, and so on. This strategy results in a rapidly increasing delay period, which effectively discourages excessive retry attempts and helps distribute the load over a longer time frame.

Exponential backoff increases the time between retries to prevent overloading the system.

Example implementation

Pseudo-code

define max_retries
define initial_delay

function retry(operation, max_retries, initial_delay)
attempt <- 0
delay <- initial_delay
while attempt < max_retries do
try
operation()
return
catch
attempt <- attempt + 1
sleep delay
delay <- delay * 2
end while
end function

Simulation