Documentation
¶
Overview ¶
Package jitter provides randomized timing for retry/backoff loops so a fleet of hosts that fail or restart together does not retry in lockstep — a synchronized "thundering herd" that can overwhelm the shared cloudbox hub. See AWS Architecture Blog, "Exponential Backoff And Jitter".
It draws from the default math/rand/v2 source, which is concurrency-safe and auto-seeded — no seeding required, and it deliberately does NOT touch the global math/rand state (keeping test determinism elsewhere intact).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Backoff ¶
Backoff returns the next "decorrelated jitter" backoff: a uniform random duration in [base, prev*3], clamped to max. Feed the result back in as prev on the next attempt — the window grows like exponential backoff while the randomization breaks phase-lock between hosts. Pass prev=base for the first attempt.
Compared to plain doubling, this keeps the self-correcting growth (a host that keeps failing backs off further) but guarantees two hosts that failed at the same instant pick different delays, so they stop retrying together.
Types ¶
This section is empty.