Retries, backoff, and jitter
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
retry safely and without synchronizing clients.
Planned topics
- Retry only transient failures (timeouts, 503, connection reset) on idempotent operations.
- Never retry non-idempotent POSTs unless protected by an idempotency key.
- Exponential backoff: wait 100 ms, 200 ms, 400 ms, with a cap and a maximum attempt count.
- Jitter: add randomness so clients do not all retry at the same moment.
- Retries only inside the latency budget; a retry budget (for example at most 10% extra calls) limits storms.
Draft outline details
Demonstration
RetryConfig cfg = RetryConfig.custom()
.maxAttempts(3)
.intervalFunction(IntervalFunction.ofExponentialRandomBackoff(100, 2.0, 0.5))
.retryExceptions(IOException.class, TimeoutException.class)
.build();Check your understanding
Why add jitter?
Show answer
To stop all clients retrying at the same instant and re-overloading the service.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.