"The payment service went down and took checkout with it." Anyone who has been through an incident like that knows payment almost never goes down all at once. It gets slow. Checkout requests hang there waiting, the pool runs out of connections, the threads run out, and suddenly the product page, which doesn't even use payment, stops responding too. The failure wasn't payment. It was the lack of a boundary around it.
Resilience isn't a framework you install. It's a set of small decisions made before the incident, and most of them fit in a few lines of code. This article brings together the five patterns everyone mentions and the others that show up as the system grows, with what each one solves, how to configure it and where it usually goes wrong. The examples come from this site, from my CRM and from a RAGTechnique that retrieves relevant passages from a document base and hands them to the model with the question, so it answers from sources, not memory alone. app I maintain.
1. Timeout: Give Up in Time
Without a timeout, your application waits as long as the dependency wants. And a slow dependency is worse than one that's down: the one that's down returns an error in milliseconds, the slow one holds on to resources for seconds.
How to pick the number. The AWS Builders' Library suggests starting from the dependency's measured latency: pick a high percentile (p99.9, for example) and accept that this fraction of calls will hit a false timeout. A number pulled out of thin air is usually too high (30 seconds, the default in a lot of libraries) or too low (cutting off calls that would have succeeded).
Propagate the deadline. Google's SRE book has an example that sums up the idea: if the request had a 30 second deadline and has already used 7, the next call gets 23, not another 30. Without that, the service further down keeps working on a response nobody is going to read.
In Node, AbortSignal.timeout() has existed since version 17.3, and native fetch has been stable since 21:
const response = await fetch(url, { signal: AbortSignal.timeout(5_000) });This site does exactly that: every article fetch done on the server has a 5 second limit. In my CRM, the check that decides whether a form can be embedded on another domain has 1.5 seconds, because it runs before the page opens. If it times out, the safe answer is to block the embed, not allow it.
2. Retry with Backoff and Jitter: Try Again Without Hammering
A lot of failures are transient: a lost packet, a replica restarting. Trying again fixes it. The problem is how.

Exponential backoff waits longer and longer between attempts: 1, 2, 4, 8 seconds. On its own, it still has a flaw: if a thousand clients failed together, all thousand come back together at second 1, again at 2, again at 4. Jitter is the randomness that spreads those retries out. Marc Brooker's 2015 post on the AWS Architecture Blog compared the variants through simulation: backoff without jitter was "the clear loser"; among the ones with jitter, Full Jitter (waiting a random value between zero and the exponential cap) and Decorrelated Jitter came out ahead.
Three rules separate a useful retry from a dangerous one:
- Only on idempotent operations. GET, PUT and DELETE can be repeated. A payment POST, only with an idempotency key. AWS does this in its own APIsContract that defines how one program asks another for data or actions: which endpoints to call, what to send and what comes back. On the web, usually HTTP with JSON. with a token sent by the client, and rejects the same token with different parameters.
- In one layer only. If the front end tries 3 times, the gateway 3 and the service 3, one database failure turns into 27 calls. AWS recommends retrying at a single point in the stack.
- With a budget. Google caps it at 3 attempts per request and, on the client, only retries while retries are under 10% of the total. When the failure is widespread, the budget runs out and the client stops making things worse.
In the CRM, background jobs use the queue library's retry, with up to 5 attempts and exponential wait. Sending emails from sequences is the exception: it has no automatic retry, with a comment in the code explaining that resending blindly would duplicate the email to the customer.
3. Circuit Breaker: Stop Calling Something That's Already Going Down
Retry helps with short failures. With long failures, it just adds load to something that can't take any more. The circuit breaker, described by Martin Fowler in 2014 based on Michael Nygard's book Release It!, works like the breaker in your house, and the Azure patterns documentation describes its three states:
- Closed: calls go through, and recent failures are counted in a time window.
- Open: past the failure threshold, the breaker trips. For a while, every call fails right away, without even trying.
- Half-open: once the time is up, it lets a few test calls through. If they succeed, it closes and resets the counter. If any fails, it opens again.

The fast failure of the open state is the real gain. Checkout doesn't sit waiting 30 seconds for payment: within milliseconds it knows payment is out and can show something else.
You don't need a library to get the idea. In my CRM's integrations with external systems, an integration that errored waits 30 minutes before trying again. In the code, the constant has the comment "circuit open". It's a simple breaker, per integration, and it already keeps a system that's down from being called on every sync.
4. Bulkhead: Isolate So the Failure Doesn't Spread
The name comes from the partitions in a ship's hull: if one compartment is breached, only that one floods. In software, the partition is a resource limit per dependency: a connection pool, a semaphore or a set of threads for each service you call.
Go back to the incident from the beginning: checkout went down because slow payment used up the connections the rest of the application also relied on. With a limit of, say, ten concurrent calls to payment, the eleventh fails right away, and the product page keeps its own connections. Resilience4j, the reference library in Java, offers both forms: by semaphore and by a fixed thread pool with a bounded queue. The Azure documentation calls the large scale version cell-based architecture: customers split into groups with their own infrastructure.
5. Fallback: Return Something Useful When Plan A Fails
Fallback is plan B: a worse but useful response in place of the error.
- Old data instead of none. HTTP caching has the
stale-if-errordirective (RFC 5861, from 2010): if the origin returns an error, a stored response, even an expired one, can be used. - A designed empty state. On this blog's listing, if the API fails, the page shows the empty list with the state that was already designed for it, not an error screen. The header and everything else keep working.
- Another provider. In the RAG app I maintain, the chat uses Groq by default and falls back to Gemini when Groq's streaming fails at startup, because of a usage limit or unavailability. The decision lives in a single file, and the caller doesn't know which model answered.

Now the counterpoint, which almost no post on the subject brings up. Jacob Gabrielson, in the AWS Builders' Library, argues for avoiding fallback in distributed systems: the backup path is hard to test, can fail too and hides bugs that only show up much later. His line is direct: "Distributed fallback strategies often make the outage worse". The alternative he proposes is to make the main path more reliable and, when fallback is unavoidable, have it run all the time in production, so it isn't a surprise on incident day.
The rule I take from this: a good fallback is simpler than the main path (cached data, an empty list, an honest message). A fallback that calls another complex system needs to be exercised all the time, or it becomes one more point of failure.
Order Matters
The .NET HTTP resilience library has a "standard resilience handler" that chains five strategies, from outermost to innermost, and its defaults are a good starting point:
| Order | Strategy | .NET default | Why in this position |
|---|---|---|---|
| 1 | Rate limiter | 1,000 permits | blocks the excess before spending anything |
| 2 | Total timeout | 30 s | caps the whole operation, including every retry |
| 3 | Retry | 3 attempts, exponential with jitter | tries again within the total deadline |
| 4 | Circuit breaker | opens at 10% failures over 30 s, for 5 s | every attempt goes through it; when open, fails right away |
| 5 | Per-attempt timeout | 10 s | one slow attempt doesn't eat the others' time |
The same page shows an option that turns off retry for POST, PATCH, PUT and DELETE. That's the idempotency rule turned into configuration.
Other Patterns That Show Up as the System Grows
Load shedding. When the server is overloaded, reject the excess early (with a 503) to keep the requests it accepted fast. The two reference texts, from AWS and Google, point the same way: turning away part of the requests quickly is better than serving all of them slowly. Google also ranks requests by criticality and drops the less important ones first.
Rate limiting. The receiving side: limiting how much each client can ask for. The details, with token bucket and the 429 status code, are in the API concepts article.
Hedged requests. To cut tail latency: if the response hasn't arrived within a high percentile's time, send the same request to another replica and use whichever answers first. In "The Tail at Scale", by Jeffrey Dean and Luiz André Barroso (2013), a test on BigTable brought p99.9 down from 1,800 ms to 74 ms with only 2% more requests. It only works for reads.
Queue and dead letter queue. Work that can wait goes into a queue, and the consumer processes it at the pace it can handle. A message that keeps failing goes to a separate queue, the dead letter queue, instead of blocking the others. In AWS SQS, this is configured through maxReceiveCount. This site has a simple version of it: the job that publishes scheduled articles removes an article's schedule if it fails the check. Without that, it would retry every minute, forever.
Health check. A route that says whether the service is up, so the load balancer can pull a sick replica out of rotation and the deploy knows whether it worked. This site's pipeline hits the API's health check right after publishing.
Kill switch. A switch, usually a feature flagConfigurable switch that turns a feature on or off without shipping new code, so you can roll out gradually, test with a group or roll back fast., that turns off a non-essential feature in production without a deploy. Pete Hodgson, in his 2017 article on feature toggles, describes these switches as "a manually-managed Circuit Breaker". When payment is unstable, turning off product recommendations frees up resources for what matters.
Chaos engineering. Causing failures on purpose to find the missing boundaries before the incident. The principles published by the community talk about "experimenting on a system in order to build confidence" and about minimizing the blast radius. Netflix's Chaos Monkey takes down random instances in production.
An Example in TypeScript
Per-attempt timeout, retry only for idempotent methods and Full Jitter, no library:
const IDEMPOTENT = new Set(['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE']);
const wait = (ms: number) => new Promise((r) => setTimeout(r, ms));
export async function fetchWithResilience(url: string, init: RequestInit = {}, attempts = 3) {
const method = (init.method ?? 'GET').toUpperCase();
const max = IDEMPOTENT.has(method) ? attempts : 1;
for (let i = 1; ; i++) {
try {
const response = await fetch(url, { ...init, signal: AbortSignal.timeout(2_000) });
// 5xx and 429 are worth another attempt; 4xx is the caller's error
if (response.status < 500 && response.status !== 429) return response;
if (i >= max) return response;
} catch (error) {
if (i >= max) throw error;
}
// Full Jitter: random wait between 0 and the exponential cap (max 8 s)
await wait(Math.random() * Math.min(8_000, 250 * 2 ** i));
}
}In production, I'd use a library, because it brings circuit breaker and metrics along with it. In Node, opossum, maintained by Red Hat, does circuit breaking, and cockatiel combines retry, backoff, circuit breaker, timeout, bulkhead and fallback. In Java, Resilience4j (2.4.0, from 2026) replaced Hystrix, which has been in maintenance mode since November 2018, with Netflix itself recommending the switch. In .NET, Polly (8.9.1) brings retry, circuit breaker, timeout, fallback, hedging and rate limiter.
Quick check
Frequently Asked Questions
What is resilience in distributed systems?
It's the ability to keep working, even partially, when a dependency fails. In practice, it's a set of patterns (timeout, retry, circuit breaker, bulkhead, fallback) that limits how far a failure can spread.
What's the difference between retry and circuit breaker?
Retry tries a failed call again, for transient failures. A circuit breaker stops calling a dependency that is failing a lot, for long failures. They complement each other: the retry sits inside the circuit breaker.
What is jitter in backoff?
It's randomness in the wait between attempts. Without it, clients that failed together come back together and create spikes. With Full Jitter, each client waits a random time between zero and the exponential cap.
What is the bulkhead pattern?
It's isolating resources per dependency, like the compartments in a ship's hull. A pool or semaphore for each service you call keeps one slow service from using up all of the application's connections.
When should you not use a fallback?
When the backup path is as complex as the main one and only runs during the incident. In that case, it tends to fail too. Prefer simple fallbacks, like cache or an empty state, or have the backup run all the time.
How many times should I retry?
A few, and with a budget. Google uses at most 3 attempts per request and stops retrying when retries go over 10% of the client's calls. More than that usually just adds load to something that's already in trouble.
References
- Microsoft, Cloud design patterns: Circuit Breaker and Bulkhead, 2025 and 2026; Build resilient HTTP apps, 2026.
- AWS Builders' Library, Timeouts, retries, and backoff with jitter, Using load shedding to avoid overload and Avoiding fallback in distributed systems, 2019; Making retries safe with idempotent APIs.
- Marc Brooker, Exponential Backoff And Jitter, AWS Architecture Blog, 2015.
- Google, Site Reliability Engineering: Handling Overload and Addressing Cascading Failures.
- Martin Fowler, CircuitBreaker, 2014; Pete Hodgson, Feature Toggles, 2017.
- Jeffrey Dean and Luiz André Barroso, The Tail at Scale, Communications of the ACM, 2013.
- IETF, RFC 5861, stale-while-revalidate and stale-if-error, 2010; AWS, SQS dead-letter queues.
- Libraries: Resilience4j, Polly, opossum, cockatiel and the Hystrix maintenance notice, checked in 2026; Node.js, AbortSignal.timeout.
- Principles of Chaos Engineering and Netflix Chaos Monkey.
- Book: Michael T. Nygard, Release It! Design and Deploy Production-Ready Software, 2nd edition, Pragmatic Bookshelf, 2018. The chapter on stability patterns is where a good part of this article's vocabulary comes from.