Timeouts and latency budgets
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
set a timeout on every remote call from a budget.
Planned topics
- No timeout means waiting forever (or a very long default). Set connect and read timeouts explicitly.
- Start from the user-facing target (for example 1 s) and divide the budget among calls.
- Downstream timeouts must be shorter than upstream ones, or the caller gives up while work continues.
- Prefer a deadline passed along the call chain over independent timeouts.
- Measure p99 latency of the dependency to choose values (verify client settings for your HTTP client before recording).
Draft outline details
Demonstration
var factory = new JdkClientHttpRequestFactory(); // or your chosen client
factory.setReadTimeout(Duration.ofMillis(300));
RestClient payments = RestClient.builder().requestFactory(factory).build();Check your understanding
Checkout must answer in 1 s and calls inventory then payments. How do you split?
Show answer
For example 300 ms and 500 ms, leaving margin for own work.
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.