---
title: "All you need to know about timeouts"
description: "Timeouts on remote calls should always be set explicitly, because library defaults (like Java HttpClient's infinite timeout) let stuck downstream services exhaust thread pools and other resources."
url: "https://swe.quest/articles/all-you-need-to-know-about-timeouts-eed69868c3110b5a"
canonical: "https://engineering.zalando.com/posts/2023/07/all-you-need-to-know-about-timeouts.html"
source: "Zalando Engineering"
published: "2023-07-25"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["resilience","microservices","networking","jvm"]
---

# All you need to know about timeouts

A post on [Zalando Engineering](https://swe.quest/sources/zalando.md), published 2023-07-25, 8 min read, How-to. Original: [https://engineering.zalando.com/posts/2023/07/all-you-need-to-know-about-timeouts.html](https://engineering.zalando.com/posts/2023/07/all-you-need-to-know-about-timeouts.html)

## Summary

Timeouts on remote calls should always be set explicitly, because library defaults (like Java HttpClient's infinite timeout) let stuck downstream services exhaust thread pools and other resources. Connection timeout should derive from network RTT (roughly RTT × 3), while request timeout should come from measured latency percentiles gathered in shadow mode, e.g. p99.9 for a 0.1% false-timeout rate. For chained calls, either split the SLA budget across services or wrap the chain in a time limiter such as CompletableFuture.orTimeout or Resilience4j TimeLimiter. Retry only on timeouts and 5xx for idempotent operations, using Idempotency-Key headers, circuit breakers and exponential backoff with jitter, and avoid retries when p99 sits close to p50.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Resilience](https://swe.quest/tags/resilience.md) (Distributed systems)
- [Microservices](https://swe.quest/tags/microservices.md) (Backend & APIs)
- [Networking](https://swe.quest/tags/networking.md) (Infrastructure)
- [Java & JVM](https://swe.quest/tags/jvm.md) (Languages)

## Prerequisites

- HTTP client basics
- TCP handshake ([easy posts on Networking](https://swe.quest/tags/networking.md?difficulty=easy))
- latency percentiles ([easy posts on Performance engineering](https://swe.quest/tags/performance.md?difficulty=easy))
- microservice calls

## Keywords

Resilience4j, CompletableFuture, Java HttpClient, Idempotency-Key, circuit breaker, exponential backoff

## Related posts

- [How a shared merchant data service can degrade gracefully](https://swe.quest/articles/how-a-shared-merchant-data-service-can-degrade-gracefully-8de99a9e03ed71ec.md): Grab Engineering · 2026-11-18 · Medium · 10 min read · Resilience, Caching, System design, SRE, Databases
  Grab's merchant data service suffered a cascading failure when cache read timeouts fell back to the database, retries piled on, and availability collapsed.
- [Infrastructure patterns for agentic applications](https://swe.quest/articles/infrastructure-patterns-for-agentic-applications-ae04a737545ff7c9.md): Render · 2026-07-29 · Medium · 12 min read · AI agents, Resilience, Scheduling, Queues & messaging, System design
  Agents are long-running, stateful and non-deterministic, so running them inside an HTTP request handler breaks in production.
- [10 Tips for Building Resilient Payment Systems](https://swe.quest/articles/10-tips-for-building-resilient-payment-systems-94c9ade99576742c.md): Shopify Engineering · 2022-07-28 · Medium · 13 min read · Payments & fintech, Resilience, Observability, Incidents & postmortems, Ruby
  Ten lessons from Shopify's payment infrastructure for keeping payment systems reliable at scale.
- [Risk-driven backbone management during COVID-19 and beyond](https://swe.quest/articles/risk-driven-backbone-management-during-covid-19-and-beyond-d86dfe7277d74180.md): Meta Engineering · 2021-08-09 · Hard · 3 min read · Networking, Capacity planning, Resilience, SRE
  Facebook's global backbone withstood the COVID-19 traffic surge by computing risk metrics (demand loss, availability, latency stretch) over enumerated failure scenarios.
- [More Reliable Connections to Your Repls](https://swe.quest/articles/more-reliable-connections-to-your-repls-07578bd14f5efb1d.md): Replit · 2024-03-18 · Medium · 5 min read · Load balancing, System design, Resilience, SRE, Real-time systems
  Replit split reverse WebSocket proxying out of Conman, its container manager on GCE VMs, into a dedicated service called Eval that sits between clients and Conman VMs.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
