Timeouts, Retries, Idempotency and Distributed Messaging
Learn Timeouts, Retries, Idempotency and Distributed Messaging (Phase 3 · Microservices Communication (Essential), Microservices) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Timeouts and retries • Timeout budget : choose timeouts from the user-visible SLA downwards: if the API must answer in 2 s and calls 2 services, each gets well under 1 s. A timeout must be shorter than the caller's own timeout, otherwise the caller gives up while work continues. Set connect and read timeouts; HTTP clients default to infinite. • Retries help with transient failures (network blips, deployments, 503), but only for idempotent operations (GET, PUT, DELETE, or POST with an idempotency key). Use exponential backoff with jitter and a small max attempts; never retry non-transient...