CSE Roadmap

Core tier · about 3 hours · 8 parts

Part 4 of 8 · 1 min read

Jitter

Randomness spreads out the herd.

Backoff has a flaw. When a service is degraded, many clients see failures at about the same moment. They all wait the same time and retry together, which hits the service with a spike. UDS calls this a retry storm.

The fix is jitter: a random part in the delay. UDS gives:

delay = random(0, min(cap, initial_backoff × 2^attempt))

Now the retries spread out in time, which smooths the load.

Jitter

Jitter is a random amount added to or taken from a delay so that many clients do not act at the same instant.

Example: instead of every client retrying at exactly 2 seconds, each picks a random time between 0 and 2 seconds.

A worked example (made up). 1,000 clients fail at second 0. Without jitter, all 1,000 retry at second 2 and again at second 6 (2 plus 4), so the server sees spikes of 1,000 calls at once. With jitter on the first retry, each client picks a time in 0 to 2 seconds, which is about 500 calls per second over two seconds. The spike has become a ramp.

Check yourself: 1. What problem does backoff alone leave? 2. Which range does the book's jittered formula pick from? 3. In the example, what is the size of the first spike with and without jitter?