Stage 4 · Reliability · Hard · 15 min
Cascading failures, load shedding and backpressure
See how one slow service makes everything that calls it slow too, and the defences: timeouts, load shedding, backpressure, bulkheads and retry budgets.
What each interview level is expected to know
Learn first: Timeouts, retries and idempotency, Circuit breakers and bulkheads
After this lesson you can:
- Follow how one slow service makes everything that calls it slow.
- Work out how retries at each layer multiply the load.
- Apply load shedding, backpressure, bulkheads and capped retries.
Start here
See it in 60 seconds
How one slow service spreads
One slow service makes everything that waits on it slow too; limits, fast refusals and timeouts stop the slowdown from spreading.
Scene 1 of 6 · A chain of calls
Each page calls the web server, which calls the orders service, which calls the stock service.
- Users — healthy
- Web server — healthy
- Orders service — healthy
- Stock service — healthy
- Orders it can finish each second
- not shown yet
- Waiting in line after a minute
- not shown yet
- A chain of calls. Each page calls the web server, which calls the orders service, which calls the stock service.
- One service slows. Say the stock service slows from 50 ms to 5 s an answer.
- Callers get stuck. Say it has 20 workers, each stuck 5 s on a stock call: 20 ÷ 5 = 4 orders a second.
- The line grows. With 6 arriving a second and 4 finished, the line grows by 2 each second: 120 after a minute.
- The slowdown spreads. The web server now waits on the orders service, so even pages that never need stock time out.
- Refuse the extra. A queue capped at 12 answers 503 at once for the extra 2 a second, so the line stops growing.
- Now you try. Orders can finish 4 a second. How many arrive each second? For example: 8 a second against 4: with no limit, the line grows by 4 a second, and after a minute the newest waits 60 s. With load shedding, 4 a second get a fast 503, and the 4 that are kept still finish on time.
Scene 1 of 6: A chain of calls. Each page calls the web server, which calls the orders service, which calls the stock service.
Key points
- A caller that waits on a slow service is stuck too, and its own callers then wait on it.
- When work arrives faster than it finishes, the line grows each second, and retries make it grow faster.
- A bounded queue that answers 503 at once keeps the work it accepts on time.
- Timeouts, circuit breakers and separate thread pools each stop one slow part from taking down the rest.
In plain words
Say a web server calls an orders service, and the orders service calls a stock service. Then the stock service gets slow: an answer that took 50 ms now takes 5 seconds. The orders service has 20 workers, and each is now stuck for 5 seconds, so it finishes only 4 orders a second. If 6 orders arrive each second, 2 more join the line every second: 120 are waiting after a minute. The web server is waiting on the orders service, so its own pages start to time out. One slow service has become three. That spread is a cascading failure.
A system rarely fails all at once. More often, one slow dependency backs up, and the delay spreads to everything that calls it. A call that takes 5 seconds instead of 50 ms holds a caller's worker 100 times longer. That caller's own pool then fills, and it stops serving anyone. Left unchecked, this backlog can spread through a whole chain of services. The defenses are bounded timeouts, rejecting some requests early, telling upstream callers to slow down, and giving each dependency its own separate worker pool.
The problem it solves
A service that gets slow is worse than one that fails outright. A failed call usually returns at once. A slow call holds the caller's (One line of work inside a running program. A server runs many threads, so it can work on many requests at the same time.) for the whole wait, so the caller's pool fills and it starts timing out for its own callers. Retries then multiply the load on the service that was already struggling.
Why it matters
A large outage often starts small: one service gets slow, and the slowness spreads to everything that waits on it. Interviewers test this with a question such as "What happens when the database gets slow?" A good answer follows the slowdown up the chain and then names what stops it.
A worked example
A server holds 200 threads. Each request to a slow dependency now takes 2 seconds instead of the usual 20 ms. At 100 requests arriving each second, 100 × 2 = 200 requests are in flight after only 2 seconds. That fills every one of the 200 threads, leaving none free for healthy requests.
Think of it like…
Think of a blocked exit on a motorway. Cars for that exit (A waiting line for work. One part adds messages, and another takes them off and handles them later, at its own pace.) back onto the main road. Soon drivers going somewhere else are stuck as well.
Where this analogy stops working
A queue that spreads to traffic with nothing wrong is the useful part. But cars cannot vanish, and requests can. A service can give up on a slow call after a (The time a caller waits before giving up on a call and treating it as failed.), and refuse new work when its queue is full. Those two moves are how software clears the jam.
Try it
See it working
Also try: Queues & backpressure · Retries, backoff & jitter · Circuit breaker
Mechanics
How it works
The pictures follow this page's chain: a web server, an orders service with 20 workers, and a stock service. Stock slows from 50 ms to 5 seconds while 6 orders arrive each second.
Bound every wait
Pick a case to follow belowWith this case: With no timeout, orders finished 4 orders a second while 6 arrived. After a minute 120 were waiting, and web pages timed out.
Users, 6 orders a second Users 6 orders a second Web server, shows pages Web server shows pages Orders, 20 workers Orders 20 workers Stock, was 50 ms, SLOW, NOW Stock was 50 ms 5 s per answer SLOW - Users — 6 orders a second — healthy
- Web server — shows pages — healthy
- Orders — 20 workers — healthy
- Stock — was 50 ms — SLOW — NOW — 5 s per answer
- Call
- Error or timeout
Step 1 of 3Step 1 of 3 · Stock
Watch: Stock slows to 5 seconds
- What happens
- An answer that took 50 ms now takes 5 seconds.
- Why
- Say its database is overloaded. Stock is slow, not down.
- What changes
- Every order needs a stock check, so every order is now waiting on it.
- Next
- Orders finishes only 4 orders a second
Each worker is held for5sOrders finished4a second6 arrive a secondOrders waiting0no lineWeb pagesworkingusers get an answerStep 1 of 3: Stock. Stock slows to 5 seconds. An answer that took 50 ms now takes 5 seconds.
Put a timeout on every call. When the stock service slows to 5 seconds, a 1-second timeout frees each worker after 1 second. The caller gets an error it can handle, and its workers do not pile up behind the slow service. Pass the time left down the chain too, so a deeper service can drop work its caller has given up on.
In the picture, with no timeout each worker waits 5 seconds, so orders finishes 4 orders a second. 2 more join the line each second: 120 after a minute, and web pages time out.
With a 1-second timeout, each worker is free after 1 second. 20 workers can then take 20 orders a second, so no line builds. Users get a clear error fast instead of a page that hangs.
Shed load early
When a service has more work than it can finish, it rejects some requests at once, with (The rules an app or browser uses to ask a server for something and get an answer, such as GET /profile/42 and then 200 OK.) 503 or 429. It drops the least important first, so the rest still succeed. A fast "no" is better for everyone than an answer that arrives after the caller has given up.
Apply backpressure
Pick a case to follow belowWith this case: With no limit, 120 orders were in line after a minute. Each new one waited 30 seconds, long after the web server had given up.
Users, 6 orders a second Users 6 orders a second Web server, shows pages Web server shows pages Orders, 20 workers, NOW Orders 20 workers 12 in line NOW Stock, was 50 ms Stock was 50 ms - Users — 6 orders a second — healthy
- Web server — shows pages — healthy
- Orders — 20 workers — healthy — NOW — 12 in line
- Stock — was 50 ms — healthy
- Call
Step 1 of 2Step 1 of 2 · Orders
Watch: After 6 seconds, 12 orders are in line
- What happens
- 6 orders arrive each second and 4 are finished, so the line grows by 2 a second.
- Why
- At 4 a second, the last of 12 orders waits 3 seconds.
- What changes
- Nothing stops the line from growing.
- Next
- After a minute, 120 orders are in line
Orders in line12no limitWait for a new order3sweb still waitsRefused at once0a secondStep 1 of 2: Orders. After 6 seconds, 12 orders are in line. 6 orders arrive each second and 4 are finished, so the line grows by 2 a second.
Give every queue a limit. A queue capped at 12 fills up and then refuses new work, which tells the sender to slow down. A queue with no limit hides the problem: it grows until the waits are useless or the memory runs out.
In the picture, the line grows by 2 a second and holds 12 orders after 6 seconds. Capped at 12, the extra orders get a fast 503, and every order in line waits at most 3 seconds.
With no limit, 120 orders are in line after a minute, and a new one waits 30 seconds. The web server gave up after 10, so orders is doing work nobody is waiting for.
Isolate with bulkheads
Give each dependency its own pool of threads or connections. Say search may use 10 of the server's 100 threads. If search hangs, 10 threads are stuck and checkout still has the other 90.
Cap retries
Pick a case to follow belowWith this case: Retrying at every layer turned one click into 27 calls to the service that was already down.
App, one click App one click Web server, shows pages, NOW Web server shows pages 3 calls NOW Orders, 20 workers Orders 20 workers Stock, was 50 ms Stock was 50 ms - App — one click — healthy
- Web server — shows pages — healthy — NOW — 3 calls
- Orders — 20 workers — healthy
- Stock — was 50 ms — healthy
- Call
- Error or timeout
Step 1 of 3Step 1 of 3 · Web server
Done: The app tries the web server 3 times
- What happens
- Each try fails, because something further down fails.
- Why
- Every layer was given its own retries.
- What changes
- 3 calls reach the web server.
- Next
- Each of those tries orders 3 times
Calls to web3Calls to orders0Calls to stock0per clickStep 1 of 3: Web server. The app tries the web server 3 times. Each try fails, because something further down fails.
What these pictures simplify. These pictures use whole seconds and steady rates: 6 orders arrive each second, and each worker waits the full 5 seconds. Real traffic comes in bursts. The cascading failures lab above runs many requests through full worker pools.
Retries add load at the worst moment. A (A cap that limits retries to a share of normal traffic, so retrying never adds unbounded extra load.) limits them to a share of normal traffic, such as 10%. Retry at one layer only, because attempts multiply across layers: 3 × 3 × 3 = 27.
In the picture, stock is down and each layer makes up to 3 attempts. The app (A tree that stores words one letter per step, so words that start the same share a path.) the web server 3 times, each of those tries orders 3 times, and each of those tries stock 3 times. That is 27 calls for one click.
Retrying only in orders, next to the fault, sends 3 calls to stock. The click still fails, but the load does not multiply.
Use it when
- Any service that calls another service or a database and waits for the answer: it needs a timeout and a limit on waiting work.
- Traffic with sudden peaks, such as a sale: shedding the extra keeps the service working for the requests it accepts.
- A server shared by important and optional features: bulkheads keep a slow optional feature from taking the threads checkout needs.
Skip it when
- Work that can wait, such as a nightly report: put it in a queue and do it later. Do not reject it.
- Shedding at random: decide the order ahead of time, so optional requests such as recommendations go before payments.
- Retrying a 503 at once: the client puts back the very load the server tried to drop. Back off first.
Check yourself
Judgement
Trade-offs and how it fails
What you give up
- Availability
- Rejecting some requests keeps the service working for the rest. Without it, an overloaded service ends up slow for every request.
- Completeness
- A rejected request fails where the user can see it. The client must try again later or show a simpler page.
- Tuning
- Every limit is a number someone must choose and revisit: the timeout, the queue size, the pool sizes, the retry budget. A limit set too low rejects work the service could have done.
Failure modes
- Thread pool exhaustion: every worker waits on a slow dependency, so healthy endpoints stop responding too.
- Retry amplification: with up to 3 attempts at each of three layers, one failing call becomes 27 calls at the bottom.
- Unbounded queues: (How long one request takes, from sending it to getting the answer.) climbs for minutes before anything alerts, then memory runs out.
- A restart into full load: a crashed server comes back with empty caches and gets all the waiting traffic at once. It falls over again.
In the real world
- Google's book on running reliable services, known as the SRE book, has a chapter on cascading failures. It covers load shedding, simpler answers under load, and limits on retries.
- The Amazon Builders' Library has an article, "Using load shedding to avoid overload". It explains why a service should reject extra requests early, so the ones it accepts still finish in time.
- Netflix's Hystrix library gave each dependency its own thread pool and circuit breaker. Netflix put it in maintenance mode in 2018 and points new projects to Resilience4j. Source: Netflix Hystrix on GitHub (checked 14 October 2026)
Trade-offs to be ready to discuss: Load shedding vs queueing · Aggressive retries vs load shedding
Check yourself
Interview
What interviewers look for
- Asked "what if the database is slow?", follow the cascade out loud: "Pools fill, callers time out, and retries add load." Then name the defences.
- Say which requests you would shed first: "Recommendations and search suggestions go before checkout."
- Pair (Waiting longer after each failed attempt before trying again.) with a retry budget: "Retries are at most 10% of traffic, and only one layer retries."
- Prefer a fast refusal: "A full queue answers 503 at once. That is better than a timeout 5 seconds later."
Say it out loud: Why can a slow dependency be more dangerous than one that is down?
Expected depth by interview level
Levels describe the depth interviewers probe, not years of experience. Choose a level on the learning path to highlight it.
- JuniorBeyond this level
- Not usually expected.
- MidUseful
- How one slow service slows everything that calls it.
- SeniorCore
- Load shedding, backpressure and bulkheads against cascades.
- StaffCore
- Failure domains and blast radius.
Practice
Apply it
Three harder questions
The first two use the idea on a new case. The last asks you to judge a design.
Apply it
Apply it
Judge a design
Go deeper
Sources and further reading
First-hand sources to check this page against and to go further. They are standards, official docs, original papers, and guides from engineering and security teams. Each link was opened on 8 November 2026.
- Engineering guideAddressing Cascading FailuresGoogle SRE bookHow overload spreads from one server to the next, and the defences that stop it.
- Engineering guideHandling OverloadGoogle SRE bookPer-client limits, request priority, and rejecting work early when a server is full.
- Engineering guideUsing load shedding to avoid overloadAmazon Builders’ LibraryWhy a server that accepts everything ends up serving nothing on time.