Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Zalando Engineering 8 min read How-to mediumAdept

All you need to know about timeouts

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.

Assumes: HTTP client basicsTCP handshakelatency percentilesmicroservice calls

Related posts

  • How a shared merchant data service can degrade gracefully

    Grab Engineering mediumAdept

    Grab's merchant data service suffered a cascading failure when cache read timeouts fell back to the database, retries piled on, and availability collapsed. The redesign rests on one rule: a fallback is only safe if its work is bounded. Requests get a priority class derived from authentication. A weighted, cross-instance token budget sits in front of the database on the fallback path, and deferrable traffic is rejected outright on cache errors. Per-class connection pools and circuit breakers act as bulkheads, scoped runtime throttles give responders control without deploys, and an opt-in SDK cache serves stale values within explicit freshness windows.

  • Infrastructure patterns for agentic applications

    Render mediumAdept

    Agents are long-running, stateful and non-deterministic, so running them inside an HTTP request handler breaks in production. The progression starts with web-queue-worker (enqueue a durable run record and return a run ID), adds idempotency for at-least-once retries and saga-style compensation for partial failures, then moves to workflow engines whose deterministic coordinators replay recorded history while non-deterministic model and tool calls live in steps. Fan-out/fan-in needs explicit partial-failure thresholds (e.g. Promise.allSettled) and concurrency caps or token buckets to avoid contention on shared rate limits. The patterns are then mapped onto Render Workflows (beta), which handles queueing, workers and retries but leaves idempotency, compensation, approvals and cost controls to the application.

  • 10 Tips for Building Resilient Payment Systems

    Shopify Engineering mediumAdept

    Ten lessons from Shopify's payment infrastructure for keeping payment systems reliable at scale. Start with low timeouts everywhere: about 1s to open a connection and 5s to read, write or query. Use circuit breakers via Semian, keyed per merchant country so one local acquirer outage stays isolated, and reason about capacity with Little's Law. Track the four golden signals, use structured logs with correlation IDs, and make retries safe with idempotency keys. ULID keys cut INSERT time by 50% versus UUIDv4. The rest covers reconciliation anomalies, load testing against a simulated benchmark gateway, checkout throttling, and incident management and retrospectives.

  • Risk-driven backbone management during COVID-19 and beyond

    Meta Engineering hardMaster

    Facebook's global backbone withstood the COVID-19 traffic surge by computing risk metrics (demand loss, availability, latency stretch) over enumerated failure scenarios. Component failure likelihood and duration come from MTBF/MTTR estimates built with clustering and Bayesian regression on features like vendor and region. A sharded simulation runs the production SD-WAN controller code per failure scenario. The resulting metrics pointed to at-risk regions, which drove proactive capacity deployment and downgrading latency-insensitive traffic from QoS class 3 to class 4, so the same SLOs could be met with less capacity.

  • More Reliable Connections to Your Repls

    Replit mediumAdept

    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. Previously, frequent Conman rollouts could disconnect a client twice (once when the proxying VM died and again when the target VM died), complicated autoscaling, and blurred the cause of session failures. With Eval, Conman updates cause at most one disconnect, Eval drains connections with a 30h+ shutdown grace period, scales independently on active connections, and its observability pinpoints whether failures come from token validation, Controlplane lookups or the remote Conman connection.

The quest for software engineering knowledge.

Look:
Layout: