BeginnerCoder

Lesson 19 — Exponential backoff + jitter

Add randomness to retries

If 1,000 clients fail at the same moment and all retry after exactly 100 ms, they hit the server again at the same moment — a thundering herd. Jitter adds a random part to each wait, so retries spread out. With "full jitter", the wait is a random number between 0 and the backoff value.

To make the output checkable, random here is a fake that returns fixed numbers; real code uses Math.random().

Why it matters: jitter is what stops retries from turning a small outage into a big one.

Want it another way?
Task

Compute wait as a random share of base (base times random(), rounded to whole ms) and log base and wait.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.

Keep going with DevOps Foundations

Ready for more? Optional paid resources that pick up where this lesson leaves off.

Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.