SteelReed

Search

Search posts, questions…

MicroservicesQuestion 12 / 24

Junior

Why does every outbound call need a timeout, and how do you retry correctly with backoff and jitter?

Short answer

Without timeouts, a hung dependency holds threads forever; pools are finite (Tomcat defaults to 200), so even unrelated APIs die. Retry only transient errors, never errors caused by the request, and retry with capped exponential backoff and jitter.

400, 401, 404, 422timeout, 429, 503noyesCall dependency withtimeoutWhich error?Don't retryOperation idempotent?Backoff + full jitter

3 points to say:

  1. Always set timeouts: short connect (1–2 seconds), read based on the other side's p99, plus an overall deadline across retries.
  2. Retry only transient errors (timeouts, connection errors, 429, 502–504); retry writes only when surely idempotent.
  3. Exponential backoff + full jitter prevents a thundering herd; retry at one layer with a retry budget (3 layers × 3 tries = 27 calls).

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.