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.
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.
A quick 3-question quiz on this lesson — instant feedback.
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.
Project-based DevOps Foundations courses if you want a structured paid path after the free lessons. Wait for a sale — prices drop often.
Browse on Udemy →Search Amazon for DevOps Foundations books — check the publication year so the examples match current versions.
Search Amazon →