Bulkheads, Load Shedding and Backpressure: Staying Up When Demand Exceeds Capacity


System Design Phase 11: Resilience Engineering
Applied Lesson 64 of 86 18 min read Updated Nov 30, 2026

The search service handles 1,000 requests per second at 100% utilisation. A marketing push sends 1,500. Nothing crashes. CPU sits at 100%, the process is healthy, every health check is green. And yet the error rate on the client side is 100%.

What happened is a queue. The extra 500 requests per second piled up in an unbounded in-memory queue. After 10 seconds there were 5,000 requests waiting, which is 5 seconds of work at 1,000 per second. Clients give up after 1 second, so every request the server finished was for a caller who had already left. The server was busy doing work that nobody would read. Then the clients retried, and the offered load went to 2,500.

The fix was not more servers. It was a bounded queue, a concurrency limit, and the willingness to say “no” quickly to some requests so the rest could be served on time. That is what this article is about: bulkheads, backpressure and load shedding, the tools that keep a service at full useful throughput when demand exceeds supply.

What it is

Three related ideas, each answering a different question.

  • Bulkheads answer “how do I stop one dependency from consuming everything I have?” You partition a resource (threads, connections, concurrent calls) so each dependency or tenant gets its own slice. A flood in one compartment does not sink the ship.
  • Backpressure answers “how does a slow consumer tell a fast producer to slow down?” The consumer signals how much it can take, and the producer waits or slows instead of piling up work.
  • Load shedding answers “when I cannot serve everything, what do I drop?” You reject some work early and cheaply, ideally the least important and the least likely to succeed, so the rest completes within its deadline.

All three are about the same quantity: goodput, the rate of requests that finish successfully within their deadline. Throughput counts work done. Goodput counts work that mattered.

How it works

Why unbounded queues kill latency

Latency vs throughput shows that queueing delay grows sharply as utilisation approaches 100%. For a simple M/M/1 queue the mean time in system is the service time divided by (1 minus utilisation): 2x at 50%, 10x at 90%, 100x at 99%. Above 100%, there is no steady state at all. The queue grows without bound for as long as overload lasts, and so does latency.

Push the slider from 70% to 90% and then to 99%, and notice that the last few percent of utilisation cost more latency than everything before them.

Why busy servers get slow

Push utilisation from 70% to 90%, then to 99%, and watch the latency multiplier.

M/M/1 model: random (Poisson) arrivals, exponential service times, one server. Mean time in system T = S / (1 − ρ). Real traffic with burstier arrivals degrades even faster.

A queue is only useful for absorbing short bursts. A queue sized for 200 ms of work smooths spikes. A queue sized for “never drop anything” turns every overload into a latency outage, because every request waits behind everything that arrived before it, including the ones whose callers have already timed out.

Bulkheads: three ways to partition

Thread pool isolation. Each dependency gets its own fixed pool of worker threads and a small queue. Calls to recommendations run on the recommendations pool; when it is full, new calls are rejected at once. The calling thread can abandon a hung call after its timeout, because the work is on another thread. The cost is a thread handoff per call and memory per pool. Hystrix popularised this model.

Semaphore isolation. A counter limits concurrent calls to a dependency on the caller’s own thread: acquire before the call, release after, reject when the count is at the limit. It is nearly free and works naturally with async and virtual-thread code, but the caller cannot walk away from a call that ignores its timeout, so it relies on the client library enforcing deadlines. Resilience4j’s Bulkhead is semaphore based, and it also offers a ThreadPoolBulkhead.

Connection pool isolation. Each downstream gets its own connection pool with a maximum size and a short acquire timeout. A slow database cannot hold the connections your cache client needs. Envoy’s per-cluster circuit_breakers thresholds (maximum connections, pending requests, active requests and retries) are this kind of bulkhead, enforced in the proxy, as described in the circuit breaker article.

Sizing a bulkhead uses Little’s law: concurrent calls equal arrival rate times latency. If a pod makes 100 calls per second to recommendations at a p99 of 80 ms, normal concurrency is about 8 and the tail is about 10. A limit of 20 leaves headroom for bursts and still caps recommendations at 10% of a 200-thread pool when it slows down.

Bulkheads exist at every scale. Per-dependency pools isolate dependencies inside a process. Per-tenant quotas isolate customers. Separate deployments for critical and batch traffic isolate workloads. Whole independent stacks isolate failure domains, which is the idea behind cell-based architecture.

Backpressure: pull vs push

In a pull system the consumer asks for work when it is ready, so backpressure is built in. A Kafka consumer polls when it has capacity; a worker takes a job from a queue when it finishes the last one. If consumers are slow, work waits in the durable log, not in someone’s heap, and lag becomes the signal to scale (see message queues).

In a push system the producer sends whenever it likes, so the consumer needs a way to say “stop”. Mechanisms, from lowest layer up:

  • TCP flow control. The receiver advertises a receive window, the number of bytes it can buffer. When the application stops reading, the window shrinks to zero and the sender stops. This is why a slow reader eventually blocks a fast writer’s write call.
  • HTTP/2 and gRPC flow control. Per-stream and per-connection windows do the same at the stream level, so one slow stream cannot hog a shared connection.
  • Reactive Streams. The subscriber calls request(n) to signal demand, and the publisher may send at most n items. Java’s Flow API, Project Reactor and RxJava implement this contract. It is backpressure made explicit in the API.
  • Bounded queues with blocking or rejecting producers. The simplest backpressure there is: when the buffer is full, put blocks or offer fails, and the producer must handle it.

The rule underneath all of these: every buffer must be bounded, and every producer must have a defined behaviour when the buffer is full (block, drop, or fail upstream). A system where any buffer can grow without limit has no backpressure; it has a delayed out-of-memory error.

flowchart LR
P["Producer"] -->|"push"| Q["Bounded queue<br/>(200 slots)"]
Q -->|"pull"| C["Consumer"]
Q -.->|"full: block, drop or reject"| P
C -.->|"request(n) / TCP window"| P
style P fill:#F1EFE8,stroke:#888780,color:#444441
style Q fill:#FAEEDA,stroke:#854F0B,color:#633806
style C fill:#E1F5EE,stroke:#0F6E56,color:#085041

Admission control and adaptive concurrency limits

A rate limit caps requests per second per client. That protects fairness, but it does not protect the server, because the server’s true capacity changes with request mix, cache hit rate and the health of its own dependencies. A fixed “1,000 RPS” limit is too high when the database is slow and too low when it is fast.

A concurrency limit caps requests in flight instead. By Little’s law, in-flight requests equal throughput times latency. If the service is healthy at 1,000 RPS and 20 ms, it has about 20 requests in flight. When latency rises, in-flight count rises with it, and a concurrency limit starts rejecting at exactly the point where queueing begins, without anyone knowing the RPS number.

Adaptive limits find that number automatically, borrowing from TCP congestion control. Netflix’s open source concurrency-limits library is the reference implementation. It measures the round trip time with no queueing (the minimum observed latency) and the current latency, and adjusts the limit:

  • AIMD: add 1 to the limit on each success, multiply it by a factor (say 0.9) when a request times out or is rejected downstream.
  • Vegas: estimate queue size as limit × (1 − minRTT / currentRTT) and grow or shrink the limit to keep that estimate small.
  • Gradient: compute gradient = minRTT / currentRTT (1.0 means no queueing, 0.5 means latency has doubled) and set newLimit = limit × gradient + queueAllowance, smoothed over time.

The effect is that a server rejects excess work with a fast 503 or RESOURCE_EXHAUSTED instead of accepting it into a queue, and the limit tracks real capacity as conditions change. Envoy offers a similar adaptive concurrency filter, and gRPC and many RPC frameworks have equivalents.

Shedding the right work

Rejecting is only half the decision. Which requests you drop determines what users experience.

By priority and criticality. Tag every request at the edge with a criticality and propagate it downstream. Google’s SRE book describes four levels (critical plus, critical, sheddable plus, sheddable), and a backend under pressure rejects sheddable work first. In an online store: checkout and login are critical; product pages are important; recommendations, analytics beacons, prefetches and batch backfills are sheddable. A service at 120% load that drops the 30% of traffic that is prefetch and telemetry has no user-visible outage at all.

Deadline-aware dropping. If a request arrives with a deadline (gRPC propagates one, or you pass a header with the remaining budget), and the deadline has already passed or is too close to finish, drop it before doing any work. Do the same when dequeuing: check the deadline again after the request waited in a queue. This one change removes the “busy serving dead requests” failure from the opening.

LIFO under overload. A FIFO queue serves the oldest request first, which under overload is the one most likely to have timed out already. Facebook described switching queues to adaptive LIFO under load (combined with CoDel-style queue time limits) in its “Fail at Scale” paper: when the queue is building, serve the newest requests first, because their callers are still waiting, and let the oldest ones expire. Unfair, but it maximises goodput.

Cheap rejection. Shedding only works if rejecting costs much less than serving. Reject as early as possible: at the load balancer or gateway, then at the start of the handler before parsing the body, never after the expensive database query. A rejection that costs 10% of a real request still lets you handle about 10x overload; one that costs 50% barely helps.

flowchart TD
A["Request arrives"] --> B{"Deadline already<br/>passed?"}
B -->|"yes"| X["Drop (no work done)"]
B -->|"no"| C{"In-flight under<br/>adaptive limit?"}
C -->|"yes"| S["Serve"]
C -->|"no"| D{"Criticality"}
D -->|"sheddable"| R["Fast 503 + Retry-After"]
D -->|"critical"| E["Short bounded queue<br/>(LIFO when building)"]
E --> F{"Still within<br/>deadline at dequeue?"}
F -->|"yes"| S
F -->|"no"| X
style S fill:#E1F5EE,stroke:#0F6E56,color:#085041
style X fill:#FCEBEB,stroke:#A32D2D,color:#791F1F
style R fill:#FAEEDA,stroke:#854F0B,color:#633806
style C fill:#EEEDFE,stroke:#534AB7,color:#3C3489

Graceful degradation and brownouts

Shedding drops whole requests. Degradation keeps the request but does less work: serve search results without the personalised re-ranking, render the page without reviews, return cached prices with a “may be out of date” flag, switch the image service to lower quality. A brownout is degradation you trigger deliberately, often by a feature flag or automatically when utilisation crosses a threshold, so the service does 60% of the work per request and serves 100% of the requests. Plan degraded modes in advance, write down which features are optional, and test the switch, because the night you need it is not the night to discover the cached path is broken.

xychart-beta
title "Goodput vs offered load"
x-axis "Offered load (% of capacity)" [50, 75, 100, 125, 150, 200]
y-axis "Goodput (% of capacity)" 0 --> 110
line [50, 75, 100, 100, 99, 98]
line [50, 75, 95, 40, 5, 0]

The upper line is a service with bounded queues, deadline checks and cheap rejection: goodput plateaus at capacity. The lower line is the same service with an unbounded queue: goodput collapses once load passes capacity.

Where it breaks

Metastable failures. Bronson and colleagues named this class in “Metastable Failures in Distributed Systems” (HotOS 2021), and Huang and colleagues studied 22 real incidents from 11 organisations in “Metastable Failures in the Wild” (OSDI 2022). The pattern: a system runs in a vulnerable state (high load but fine), a trigger pushes it over (a deploy, a cache flush, a brief network blip), and then a sustaining feedback loop keeps it broken after the trigger is gone. Retries are the classic loop: timeouts cause retries, retries add load, load causes more timeouts. Cache loss is another: an empty cache sends everything to the database, the database slows, cache refill requests time out, and the cache never warms. The defining symptom is that removing the trigger does not fix it. Recovery needs you to break the loop: shed load hard (well below normal capacity), disable retries or drop the retry budget to zero, serve stale cache, warm the cache with controlled traffic, then let load back in gradually.

Retries without budgets. Every layer that retries 3 times multiplies load by up to 4. Three layers deep that is up to 64x. Retry budgets and only retrying at one layer are covered in timeouts, retries and backoff.

Rejection that is not cheap. A server that authenticates, parses a 1 MB body and opens a database transaction before deciding to shed is not shedding. Measure the cost of a rejection.

Clients that treat 503 as “try harder”. Load shedding needs cooperative clients: honour Retry-After, back off with jitter, and count shed responses against the retry budget. Make your SDKs do this by default.

Bulkheads sized from averages. Sizing a pool from mean latency means the pool is full the first time latency hits p99. Size from the tail and test it.

Autoscaling as the only plan. Autoscaling reacts in minutes; overload arrives in seconds. Shedding keeps you alive until new capacity is ready, and new capacity is no help if each new pod immediately fills an unbounded queue.

Shedding at every layer independently. If the gateway, the service and the database pool all shed with different priorities, you can drop critical work at one layer while serving sheddable work at another. Propagate criticality end to end.

Real-world systems

  • Netflix concurrency-limits (Java, open source): adaptive limiters (AIMD, Vegas, Gradient variants) for servers and clients, with gRPC and servlet integrations.
  • Envoy: per-cluster circuit_breakers thresholds as connection and request bulkheads, plus an adaptive concurrency filter that adjusts a limit from measured latency.
  • Resilience4j: semaphore Bulkhead, ThreadPoolBulkhead and a RateLimiter, composable with its circuit breaker.
  • Google SRE practice (SRE book chapters “Handling Overload” and “Addressing Cascading Failures”): request criticality, client-side adaptive throttling based on the ratio of requests to accepts, and per-customer quotas.
  • Amazon Builders’ Library, “Using load shedding to avoid overload”: goodput vs throughput, cheap rejection, deadline checks, and the advice to load test past the point of overload.
  • Facebook “Fail at Scale” (ACM Queue, 2015): adaptive LIFO and controlled delay queues for overload.
  • TCP, HTTP/2, gRPC and Reactive Streams: flow control and demand signalling built into the protocol or API.

How to apply it

Problem Tool Default
One dependency eats all threads bulkhead per dependency limit = rate times p99 latency, times 2
Producer faster than consumer bounded queue or pull queue holds 100 to 500 ms of work
Server overloaded, capacity varies adaptive concurrency limit start near rate times latency
Overload with mixed traffic shed by criticality sheddable, then important, then critical
Work wasted on expired requests deadline propagation drop on arrival and on dequeue
Sustained overload brownout or degraded mode feature flag per optional feature

Checklist:

  • Find every queue and buffer in the request path and give it a bound and a full-buffer behaviour.
  • Propagate deadlines and drop expired work at each hop.
  • Put a concurrency limit at the server, preferably adaptive, and make rejection the cheapest code path.
  • Tag requests with criticality at the edge and shed lowest first.
  • Give each dependency a bulkhead sized from its tail latency.
  • Make clients honour Retry-After, use jitter and spend from a retry budget.
  • Define degraded modes and the flags that enable them.
  • Load test beyond capacity (150% to 200%) and check that goodput plateaus instead of collapsing.
  • Write the metastable recovery runbook before you need it: shed hard, disable retries, warm caches, ramp back.

Interview questions

Q1: Your service is at 100% CPU, healthy by every health check, but clients see almost all requests time out. What is happening and what do you change?

The service is spending its capacity on requests whose callers have already given up, almost certainly because a queue has grown past the client timeout. Throughput is high, goodput is near zero. Bound the queue to a few hundred milliseconds of work, check each request’s deadline on arrival and again on dequeue, and add a concurrency limit so excess load gets a fast 503 instead of joining the queue. Consider LIFO when the queue is building. Then look at the clients: if they retry without backoff or budget, they are adding the load that keeps the queue full.

Q2: Thread pool bulkhead or semaphore bulkhead?

A semaphore bulkhead is a counter on the caller’s thread: cheap, no handoff, and a good fit for async or virtual-thread code, but if a call ignores its timeout the caller is stuck with it. A thread pool bulkhead runs calls on a dedicated pool, so the caller can abandon a hung call and the pool caps concurrency even when a client library misbehaves, at the cost of a thread handoff and memory per pool. Use semaphores by default when your clients enforce deadlines reliably, and thread pools for legacy blocking clients you do not trust.

Q3: An outage was triggered by a 30 second network blip, but the system stayed down for 2 hours after the network recovered. Explain and propose fixes.

That is a metastable failure. The blip caused timeouts; timeouts caused retries at several layers and cache entries to expire without refreshing; the extra load kept latency above the timeouts, so the retries and cache misses continued after the network was fine. The feedback loop, not the trigger, sustained the outage. To recover: shed load well below normal capacity, set retry budgets to zero, serve stale cache, warm the cache with controlled traffic, then ramp up. To prevent: retry budgets and retries at one layer only, jittered backoff, adaptive concurrency limits, deadline-aware dropping, stale-while-revalidate caching, and a load test that injects a blip at high load and checks the system returns to normal on its own.

✅ Key takeaways

  • Measure goodput (successful work within deadline), not throughput. Under overload the two diverge sharply.
  • Every queue and buffer needs a bound and a behaviour when full; unbounded queues turn overload into a latency outage.
  • Bulkheads (thread pool, semaphore, connection pool) stop one dependency or tenant consuming shared capacity; size them from tail latency with Little’s law.
  • Adaptive concurrency limits reject at the point queueing begins; shed by criticality, drop expired requests, and make rejection cheap.
  • Metastable failures persist after the trigger because of a feedback loop such as retries or cache loss; recovery means breaking the loop, not waiting.

🧠 Check your understanding

0 / 4
  1. 1A server can process 1,000 requests per second. Offered load is 1,300 per second and the queue is unbounded. Clients time out after 1 second. After a minute, what is the goodput?

  2. 2Why does an adaptive concurrency limit protect a service better than a fixed requests-per-second limit?

  3. 3Under overload, why might a server switch its queue from FIFO to LIFO?

  4. 4A short network blip ends, but the system stays degraded for hours with high retry traffic. What is the most effective first recovery action?

Where to go next

Finished this lesson?

Mark it complete to track your progress across the roadmap.