Skip to content
StackDecode
System Design
11. Microservices ArchitectureAnimated

Timeout Pattern

Stop waiting after a set time.

The idea

Timeouts stop slow dependencies from tying up threads.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

try 1

Attempt 1 fails. Wait 1s plus up to 1s random jitter, then retry.

attempt:
1
next wait:
1
1/6

Exponential backoff spaces retries out; jitter stops every client retrying at the same moment.

Step by step

  1. 1Set a timeout per call
  2. 2Wait up to that time
  3. 3Abort and handle the failure
  4. 4Return a fallback or error

Where it is used

Every remote call.

Watch out for

A timeout does not mean the work did not happen.

Related