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.

UsersUsersWeb serverWeb serverOrders serviceOrders serviceStock serviceStock 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
  1. A chain of calls. Each page calls the web server, which calls the orders service, which calls the stock service.
  2. One service slows. Say the stock service slows from 50 ms to 5 s an answer.
  3. Callers get stuck. Say it has 20 workers, each stuck 5 s on a stock call: 20 ÷ 5 = 4 orders a second.
  4. The line grows. With 6 arriving a second and 4 finished, the line grows by 2 each second: 120 after a minute.
  5. The slowdown spreads. The web server now waits on the orders service, so even pages that never need stock time out.
  6. Refuse the extra. A queue capped at 12 answers 503 at once for the extra 2 a second, so the line stops growing.
  7. 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

  1. A caller that waits on a slow service is stuck too, and its own callers then wait on it.
  2. When work arrives faster than it finishes, the line grows each second, and retries make it grow faster.
  3. A bounded queue that answers 503 at once keeps the work it accepts on time.
  4. Timeouts, circuit breakers and separate thread pools each stop one slow part from taking down the rest.

Go deeper in the Queues & backpressure lab →

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 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 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 , and refuse new work when its queue is full. Those two moves are how software clears the jam.

Try it

See it working

Live simulationOpen the full lab →

Lab · Reliability

Cascading failures

Checkout pages go from the web server to orders, then to stock. Home pages need the web server only. Slow the stock service down, watch the slowdown reach pages that never call it, then try the defences.

Try it

Lab time 3.0 s
checkoutsUsers, 6 checkouts a secondUsers6 checkouts a second4 home/s · wait 3 sWeb server, 40 workersWeb server40 workers3 busy · 0 waitingOrders service, 20 workersOrders service20 workers1 busy · 0 waitingStock service, answers in 50 msStock serviceanswers in 50 msHealthy
  • Users — 6 checkouts a second — healthy — 4 home/s · wait 3 s
  • Web server — 40 workers — healthy — 3 busy · 0 waiting
  • Orders service — 20 workers — healthy — 1 busy · 0 waiting
  • Stock service — answers in 50 ms — healthy — Healthy
  • Request/response
  • Request
  • Response
  • Error / rejected
  • Retry
Home pages on time
100%
Healthy: last 10 s · they never call stock
Checkouts on time
100%
Healthy: last 10 s
Web workers busy
3/ 40
0 pages waiting
Orders workers busy
1/ 20
0 calls waiting
Gave up waiting
0
timeouts are off
Refused at once
0
0 by the queue limit, 0 by the bulkhead
Calls per checkout
1.0
that reached stock, last 10 s
Wasted answers
0
work done after the caller gave up

Numbers add up:Home: 14 arrived = 13 on time + 0 failed + 0 timed out + 1 in progress · Checkout: 15 arrived = 12 on time + 0 failed + 0 timed out + 3 in progressThe lab checks this sum as it runs, so a counting mistake would show here.

Controls

Stock service

Stock answers in about 50 ms.

Traffic
6/s
Defences

The web server waits at most 2.5 s for orders, and orders at most 1 s for stock.

Orders keeps at most 12 calls waiting, and answers 503 to the rest at once.

Checkouts may hold at most 20 of the 40 web workers; the rest are kept for home pages.

The web server and orders each make up to 3 attempts. This adds load; it is not a defence.

Pages answered on time (%)
Home pagesCheckouts
0501001502001s2s3s
Show data table
TimeHome pagesCheckouts
1s100100
1s100100
2s100100
2s100100
3s100100
3s100100
Calls waiting at orders, and busy web workers
Waiting at ordersWeb workers busy
01.32.53.851s2s3s
Show data table
TimeWaiting at ordersWeb workers busy
1s04
1s03
2s03
2s04
3s00
3s03

What just happened

Nothing yet. Start traffic or run an experiment.

What this model simplifies
  • Each hop takes 100 ms, slowed so a request can be followed. Inside one data centre a hop takes well under 1 ms.
  • Each worker handles one call at a time and waits for the whole call. Servers built on async code hold memory and connections instead of threads, and run out the same way.
  • Users give up after exactly 3 s and never press reload. Real users reload, which adds more load.
  • Stock has no limit on how many calls it works on at once. A real service would slow down further under the extra calls.
  • Retries go out at once, with no backoff or jitter. The retries lab shows what those change.

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.

  1. Bound every wait

    Pick a case to follow below

    With 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 secondUsers6 orders a secondWeb server, shows pagesWeb servershows pagesOrders, 20 workersOrders20 workersStock, was 50 ms, SLOW, NOWStockwas 50 ms5 s per answerSLOW
    • 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 3

    Step 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 for
    5s
    Orders finished
    4a second
    6 arrive a second
    Orders waiting
    0
    no line
    Web pages
    working
    users get an answer

    Step 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.

  2. Shed load early

    When a service has more work than it can finish, it rejects some requests at once, with 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.

  3. Apply backpressure

    Pick a case to follow below

    With 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 secondUsers6 orders a secondWeb server, shows pagesWeb servershows pagesOrders, 20 workers, NOWOrders20 workers12 in lineNOWStock, was 50 msStockwas 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 2

    Step 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 line
    12
    no limit
    Wait for a new order
    3s
    web still waits
    Refused at once
    0a second

    Step 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.

  4. 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.

  5. Cap retries

    Pick a case to follow below

    With this case: Retrying at every layer turned one click into 27 calls to the service that was already down.

    App, one clickAppone clickWeb server, shows pages, NOWWeb servershows pages3 callsNOWOrders, 20 workersOrders20 workersStock, was 50 msStockwas 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 3

    Step 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 web
    3
    Calls to orders
    0
    Calls to stock
    0
    per click

    Step 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 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 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

What is load shedding?

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: 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

A queue in front of a slow service has no size limit, and traffic stays high. What usually happens?

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 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?

A request passes through three services, then a database. Each service makes up to 3 attempts for every call it sends. The database starts failing. How many calls reach it for one user request?

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

A service has 10 workers. A slow dependency makes each call take 2 seconds. 8 requests arrive each second. How fast does the line of waiting requests grow?

Apply it

Normal traffic is 1,000 calls a second, and the retry budget is 10%. The dependency starts failing every call. At most how many retries a second are sent?

Judge a design

A service in front of a slow database puts extra work in a queue with no limit, so no request is ever turned away. What is the better design?

Next: observability, how you notice a cascade starting before users do.

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.