Failure handling in distributed systems

Hand-drawn six hatched terracotta gates set across a current of cream, sand, umber and moss contour lines that bunch against each gate and spread out beyond it.

Failure handling in distributed systems covers the design choices that decide what networked software does when a service it depends on is slow, returns errors, stops replying or is overloaded. Its main tools are timeouts, retries, circuit breakers, load shedding, idempotent operations and compensating steps. Studies of real outages find that this handling code can itself cause or prolong the failure it was meant to contain. Misused timeout values appeared in 65 of 156 reported timeout bugs, and retries sustained more than half of the self-sustaining overloads in another study (Dai et al., 2018; Huang et al., 2022).

The main disputes concern when retries help and when they amplify overload, and whether isolating a slow component protects the rest or removes healthy capacity. Others concern which overload controls work across chains of services, and how much a review of the design can establish before the system runs. Consensus, consistency models and the theory of how distributed systems fail are covered in Distributed systems.

Handling code in incident studies

Error handling, timeouts and retries recur among the causes of outages, but each study describes a selected sample. Among 156 reported timeout bugs in 11 cloud server applications, 65 involved misused timeout values, 42 involved a missing timeout check, and 56 made the system or application unavailable (Dai et al., 2018).

Code that reacts to errors is itself a frequent source of failure. In one study of production failures in data-intensive systems, 92% of catastrophic failures came from incorrect handling of non-fatal errors that the software had already signalled (Yuan et al., 2014). In a sample of 100 partial failures, the three most frequent root causes were uncaught errors, indefinite blocking and buggy error handling, which together accounted for 48% of cases (Lou et al., 2020).

Timeouts, deadlines and cancellation

A timeout bounds how long a caller waits, and its value is a trade-off. An overly long timeout keeps resources occupied, while an overly short one drives extra traffic to the backend through retries (Brooker, 2019). The gRPC framework recommends that clients set a realistic deadline explicitly and validate it with load testing (gRPC, 2025).

A deadline is a point in time by which the whole request must finish, while a timeout is a duration for one call. Passing the remaining time down the call chain keeps every service working to the caller’s original limit. The gRPC guide recommends honouring the original client’s deadline on downstream calls, and gRPC forwards it as a timeout after subtracting the time already spent (gRPC, 2025).

When a deadline expires, the work must actually stop, and that step can fail. The gRPC guide says application code must stop work it has spawned when its request is cancelled. For a long-lived call, the handler must check for cancellation itself, because the library generally cannot interrupt it (gRPC, 2025; gRPC, 2024). In a selected sample of 156 cancellation bugs across 13 projects, 30 showed resource-leak symptoms, such as locks, buffers or thread-pool capacity left held (Sethi et al., 2022).

Retries

Retries recover requests from brief faults but multiply load when a service is overloaded. Amazon’s guidance says retries improve availability for rare or transient errors and worsen failures caused by overload (Brooker, 2019). In one simulated service restart, bounded retries at the API gateway kept a dependent endpoint’s success rate around 70% at its lowest. Without retries it fell to zero (Frank et al., 2021).

Retries keep outages going after their trigger has passed. In a September 2026 GitHub incident, retries of already failing token-creation writes kept a shared database saturated. A month earlier, a client retry bug raised traffic to an internal authentication endpoint and slowed recovery (Oleksy, 2026a; Oleksy, 2026b).

Retries at several layers multiply. When each layer of a call chain retries independently, the lowest dependency can see as many attempts as the product of the layers’ attempt limits (Ulrich, 2016). Amazon’s guidance prefers choosing one layer to retry low-cost operations and notes that retrying high in the stack may redo work (Brooker, 2019).

A retry budget caps retries across all requests rather than per request. Google’s SRE guidance recommends considering such an aggregate budget, failing a request once the process has spent it. It also recommends separating retryable errors from permanent or malformed requests and signalling overload with a dedicated status (Ulrich, 2016). Budgets kept separately at each hop may not be enough. Uber estimates that in one incident, per-hop budgets alone would have raised traffic to a degraded service by 46% to 135% (Mehndiratta et al., 2026).

Retry bugs go in both directions. In a sample of retry bugs, 8 failed to retry errors that were recoverable, while 9 retried errors that were not (Stoica et al., 2024).

Backoff and jitter

Studies disagree on how much spacing out retries helps during a long overload. Exponential backoff makes each wait longer than the last, and jitter adds random variation to the wait. Google’s guidance recommends randomised exponential backoff, because retries that recur together can amplify a small disturbance (Ulrich, 2016). In a vendor simulation of 100 clients contending for one database item, adding jitter more than halved the total number of calls (Brooker, 2015).

Under sustained overload the benefit can vanish. The same author’s follow-up simulation found that per-request backoff did little when effectively unlimited clients kept sending new requests (Brooker, 2022). In a preprint’s simulation of five service tiers under correlated failures, three attempts with backoff and jitter succeeded 41.5% of the time, against 55.4% with no retries (Mehan & Saluja, 2026). Amazon’s guidance adds that capping the delay can leave all clients retrying at that capped rate, so attempts need a cap too (Brooker, 2019).

Circuit breakers

A circuit breaker stops calls to a failing dependency for a time after errors pile up, then lets a few through to test whether it has recovered. Evidence from testbeds and vendor reports shows that breakers lower load on a failing dependency, at a cost to callers that depends on the setting. In controlled experiments, retry and breaker libraries reduced load on the target with little effect on execution time at low to moderate failure rates. At higher failure rates both could substantially degrade client performance, with effects varying by library and language (Aderaldo et al., 2024). Shopify saw worker utilisation rise during a Redis outage and settle as circuits opened for the failing instances (Polan, 2020).

Breakers add their own failure modes. Amazon’s guidance cautions that they change behaviour across modes, complicate testing and add delay to recovery (Brooker, 2019). A longer open period can delay recovery and prolong the effects of a breaker that tripped by mistake (Polan, 2020). In a service-mesh testbed, queues that were too short increased dropped requests, while queues that were too long hurt response time (Saleh Sedghpour et al., 2022).

Overload: backpressure, admission control and load shedding

Backpressure tells callers to slow down, admission control decides whether to accept new work, and load shedding refuses some work to protect the rest. Controllers based on queueing delay protect completed work in experiments, but results depend on the workload and on where in a chain of services the control sits. In a test of microsecond-scale remote calls, Breakwater grants admission credits from server-side queueing delay. When demand spiked to 1.4 times capacity, it stabilised in under 20 ms, while two earlier controllers took 500 ms and 1.58 seconds (Cho et al., 2020).

In a chain of services, shedding independently at each stage compounds the chance that an end-to-end request fails. The authors of the TopFull controller therefore recommend admitting work at the entry point or applying consistent criteria across services (Park et al., 2024a). In a synthetic test of WeChat’s DAGOR controller where a request made two calls to an overloaded service, its success rate was around 50% higher than two earlier controllers’. For simple overload the techniques performed alike (Zhou et al., 2018).

Benchmarks of these controllers disagree. Goodput is the rate of requests completed within their latency objective. On one microservice benchmark, TopFull achieved 1.82 times DAGOR’s and 2.26 times Breakwater’s goodput under overload (Park et al., 2024a). On another, TopFull’s central policy failed to serve for four seconds after a spike because of its overhead, and front-end-only admission missed downstream load. The decentralised Rajomon controller reached 78% lower tail latency and 45% higher goodput than the policies it was compared with in high-load tests (Xing et al., 2025).

Who loses service under overload

Overall throughput hides that shedding concentrates the losses on some kinds of work. In a database simulation, basic admission control rejected 11.30% of requests overall but 98.46% of slow queries (Xu & Colmenares, 2023). On a microservice benchmark, admission that knew each request’s path served 1.9 times as many Get Product requests on time as local shedding. It served the same number of checkouts (Park et al., 2024a).

Prioritised shedding can protect the requests users make directly. After an outage, Netflix faced a surge of prefetch requests, which load content before a user asks for it. Its prioritised shedding coincided with availability above 99.4% for user-initiated requests, while prefetch availability fell as low as 20% (Mendiratta et al., 2024).

Work that looks optional or deferrable can still matter. In Netflix’s first production test of shedding request classes, suppressing a low-priority request exposed a race condition that caused intermittent playback errors (Correa et al., 2020). During a 2018 GitHub incident, operators paused webhook delivery, and about 200,000 webhook payloads were dropped once their delivery lifetime elapsed before processing resumed (Warner, 2018).

Restoring traffic after an outage Weak evidence: few or small studies support this

Recovery is a load problem of its own, and the evidence that reducing incoming load lets a stuck system recover rests on one test series and models. In a replicated-database test, a ten-second 80% cut in CPU led retries to push attempted requests to about three times normal, and useful throughput fell about 90%. Reducing the baseline workload by about 30% let the same system recover from the same disruption (Huang et al., 2022). In a queueing model, lowering arrivals during recovery produced rapid recovery compared with the default policy (Alvaro et al., 2025).

Demand that returns once a dependency is healthy can cause a second collapse. After DynamoDB recovered in the October 2025 AWS outage, repeated lease-renewal attempts contributed to congestive collapse in an EC2 subsystem (Amazon Web Services, n.d.i). Why some overloads persist after their trigger is gone, the metastable failures, is explained in Distributed systems.

Idempotency and replay protection

An operation is idempotent when repeating it has the same effect as doing it once. A retried write is safe only if the server recognises the repeat and returns the first outcome. Without that, a failure between two steps can repeat a side effect. In a 2013 incident, Twilio’s billing system repeatedly charged cards after starting top-ups, because it could not update account balances (Twilio, 2013).

The common mechanism ties a caller-supplied key to the result. Amazon recommends a unique identifier, provided by the caller in the API contract, to tell retries from new requests. It also recommends recording that token and the changes it governs in one atomic database transaction (Featonby, n.d.).

Replay protection has a scope and an expiry. Stripe’s API v1 can prune keys at least 24 hours old and then processes a reused key as a new request (Stripe, n.d.a). Adyen does not deduplicate keys between its regional endpoints, and Amazon EC2 can launch a second instance when the same token is sent to a different region (Adyen, n.d.; Amazon Web Services, n.d.a).

Suppressing duplicates does not by itself complete an external side effect. In a test that streamed messages from Kafka into PostgreSQL, the idempotent strategy suppressed duplicate results but left incomplete state in the database after a failure during processing (Andersson, 2026). How message brokers handle repeated delivery is covered in Event-driven architecture.

Choosing consistency for each operation

Not every operation needs the same guarantee, and the rules the data must keep decide which ones need coordination. In RedBlue consistency, operations that commute with all others and leave the application’s invariants intact can run with eventual consistency (Li et al., 2012). Invariant confluence, a formal criterion for when operations need no coordination, is covered in Distributed systems. Reservations let operations complete locally in the common case, by coordinating ahead of time outside their critical path (Balegas et al., 2015).

Sagas and compensation

A saga splits a long transaction into steps that commit one at a time and can interleave with other transactions. A partly executed saga needs compensation, steps that undo the effect of those already committed (Garcia-Molina & Salem, 1987). Other work can therefore see intermediate state: a standard microservice saga lets other operations read or write data from an incomplete transaction (Daraghmi et al., 2022). The choice between coordinating sagas through events or a central orchestrator is covered in Event-driven architecture.

Compensation can itself fail, and guidance on it is mostly vendor documentation. Microsoft advises recording compensation progress so a workflow can resume from the step that failed (Microsoft, 2026d). Temporal recommends registering a compensation before a step that may run partly, and writing the compensator to cope with an action that never happened. It warns that a compensation failure that cannot be retried leaves the rollback incomplete (Temporal, n.d.). Some failures need a person: Shopify documents refunds that fail when the customer’s bank account cannot accept them, and recommends recording the alternative resolution (Shopify, n.d.).

Steps that cannot be undone belong at the end. Microsoft recommends placing external operations that cannot be meaningfully undone after all critical validations pass (Microsoft, 2026d). Uber’s payment workflow authorises and holds funds first, then charges after the trip ends to allow for changes or cancellations (Gajera & Blinn, 2019).

Durable execution engines record each step’s progress so a workflow resumes after a crash. In one thesis prototype, a version built on such an engine had no stuck transactions in the tested scenarios, but longer request times when nothing failed (Dupaya, 2026).

Partial, gray and fail-slow failures

Many failures leave a component half working, which health checks miss. A gray failure begins when an application sees a problem that the system’s health monitor does not (Huang et al., 2017a). In a partial network partition, some nodes cannot reach each other directly while the cluster stays connected through other nodes. One study analysed 51 failures of this kind across 12 systems (Alfatafta et al., 2020). A fail-slow component keeps working, but slowly.

Fail-slow faults are rare for any one machine but recur across a large fleet. One storage vendor detected 232 fail-slow cases across 39,000 nodes in seven months, an annual rate of 1.02% (Panda et al., 2019). Detecting them from the caller’s side has limits. Client checkers based on the Panorama detector missed 68% of 22 sampled partial failures, because the affected behaviour was internal or not immediately visible to callers (Lou et al., 2020).

Isolating a slow component

Studies disagree on whether taking a slow component out of service protects the system or removes capacity it needs. Isolating detected fail-slow drives cut node-level 99.99th-percentile write latency by 48.05%; that percentile is the time within which all but one write in ten thousand finish (Lu et al., 2023c).

Isolation can also strike healthy parts. The IASO detector logged nine confirmed false positives over seven months (Panda et al., 2019). A study of hardware faults describes a deployment where taking degraded nodes offline would have reduced availability and risked data loss (Gunawi et al., 2018). Under a partial partition, one modified replication protocol recovered throughput in a three-replica test where the baseline fell to zero, but both degraded in one five-replica layout (Kida & Kawashima, 2026).

What a design review can check Weak evidence: few or small studies support this

A review of the design can check that failure paths are specified and agree across components, but guidance on what to check rests on checklists rather than measured outcomes. Laura Nolan’s SRE checklist asks reviewers to trace each request type’s critical path and fan-out, and to look for feedback loops created by retries. It also asks how the system degrades when a dependency fails, and how capacity is planned and load-tested (Nolan, 2019). Microsoft’s failure mode analysis documents dependencies in flow diagrams and records each failure’s effect on the user. It recommends revisiting the analysis as chaos tests and operating experience add information (Microsoft, 2026b).

Whether the chosen values and fallbacks work needs tests on a running system. Microsoft’s testing guide calls for checking retry policies, breaker thresholds and timeouts under realistic failures, including added latency, intermittent errors and partly available data. It uses reliability and recovery targets as pass and fail criteria for whole critical flows (Microsoft, 2026c). In one study of 198 production failures, of which 48 were catastrophic, simple tests of error-handling code could have caught the faults behind 58% of the catastrophic ones (Yuan et al., 2014).

A formal model can check a stated failure property, within the limits of what it represents. AWS engineers report that model checking exposed a data-loss risk from one possible sequence of failures, recovery steps and concurrent processing (Newcombe et al., 2015). Model checks of ZooKeeper found six severe bugs, yet the study also shows how modelling an action as atomic can hide concurrent paths in the implementation (Ouyang et al., 2025a). How reviews of design documents are run in general is covered in Design review, and proofs of correctness in Formal verification.

Further reading

  • Ulrich (2016): the Google SRE chapter on cascading failures, with its advice on retry budgets, backoff and overload signals.
  • Dai et al. (2018): a study of 156 real timeout bugs in cloud server software, classifying how timeouts go wrong.
  • Featonby (n.d.): Amazon’s account of how to make retried API calls safe with caller-supplied tokens.
  • Garcia-Molina and Salem (1987): the original paper defining sagas and compensating transactions.
  • Huang et al. (2017a): the short paper that named gray failure, the gap between what monitors and applications see.
  • Park et al. (2024a): an overload controller for chains of microservices, with a comparison against earlier controllers.

Known gaps

What this article cannot tell you yet.

  1. Whether reviewing failure handling on a design document reduces incidents or harm has not been measured.
  2. Which retry budgets and circuit-breaker recovery settings carry over between traffic patterns, service topologies and classes of work is unknown.
  3. How often stale idempotency keys, uncertain external side effects and stuck compensations occur in production is unknown: the reports describe these failures without estimating their frequency.
  4. Whether cancelling expired work releases downstream resources in production systems was not researched.
  5. Independent evaluations of retry budgets shared across services under correlated failures were not established.
  6. Whether durable execution prevents stuck workflows beyond a single thesis prototype was not researched.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 56 references