Skip to main content

Timeout Pattern

Learn Timeout Pattern (Core Microservices Patterns, Microservices Design Patterns) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What is the Timeout Pattern? A Timeout bounds how long a caller will wait for a response from a dependency before giving up and moving on (often to a fallback or an error). Without a timeout, a single slow dependency can hold a caller's thread/connection indefinitely , and that pileup can cascade into resource exhaustion across the whole call chain. Setting a Sensible Timeout Too short: healthy-but-momentarily-slow calls get killed unnecessarily. Too long: the caller stays stuck for ages before giving up. A common practice is basing the timeout on the dependency's normal p99 latency plus some...

More lessons in Core Microservices Patterns