Problem
Clients that retry, refresh, or poll on identical schedules synchronize with each other, creating periodic spikes. After an outage ends, thousands of clients retrying in lockstep can knock the recovering service down again.
Also known as: randomized-delay, backoff-jitter
Add randomness to delays and schedules so many clients do not act at the same instant.
Clients that retry, refresh, or poll on identical schedules synchronize with each other, creating periodic spikes. After an outage ends, thousands of clients retrying in lockstep can knock the recovering service down again.
Jitter breaks synchronization. Exponential backoff alone spaces retries out for one client, but a thousand clients that failed together still retry together at each step. Randomness spreads them across the interval.
The AWS Architecture Blog compared several variants. Full jitter performs well for most retry cases.
cap = min(maxDelay, base * 2^attempt)
sleep = random(0, cap) # full jitter
# decorrelated jitter
sleep = min(maxDelay, random(base, prev * 3))
The same idea applies outside retries. Add plus or minus ten percent to cache TTLs so entries do not expire together, offset cron jobs by a random number of seconds, and stagger client reconnects after a server restart.
None, one line of code
Low, occasional tuning
Low, simple idea
Same random seed across instances recreates synchronization
Jitter range too narrow still leaves spikes
Added delay exceeds a timeout budget