Load shedding

On this page 7

Load shedding is the deliberate rejection or dropping of part of the incoming requests when a server or service is overloaded, so that the remaining requests can still be processed within acceptable latency. In the reliability of servers, it is a defensive mechanism that trades partial, controlled failure for the alternative of total collapse.

The idea rests on a simple observation: a system pushed beyond its capacity does not merely slow down, it often stops doing useful work because queues grow, timeouts expire and clients retry. By refusing excess work early and cheaply, typically with an HTTP 503 or 429 response, load shedding keeps throughput close to capacity and protects the service for most users.

Why overloaded servers need load shedding

Without load shedding, an overloaded server accepts every request and places it in a queue. As the queue grows, every request waits longer, including those that will eventually time out on the client side. The server then spends CPU time on work whose result nobody will receive, which is known as goodput collapse: raw throughput stays high while useful throughput falls toward zero.

Client behavior makes this worse. Timed-out clients retry automatically, multiplying the incoming load exactly when the server is weakest, which can produce a retry storm or a cascading failure across dependent services. Load shedding breaks this loop by failing fast: a rejected request costs microseconds instead of seconds of wasted processing.

The table below contrasts the behavior of a server under overload with and without load shedding.

AspectWithout load sheddingWith load shedding
Latency of accepted requestsGrows without boundStays near normal
Useful throughputFalls sharplyStays close to capacity
Memory usageRises with queue lengthBounded by queue limits
Client experienceTimeouts for nearly everyoneFast errors for some, success for most
Recovery after the spikeSlow, backlog must drainAlmost immediate
Server behavior under overload

How load shedding decides what to reject

A load shedding mechanism needs an overload signal and a rejection policy. The signal tells the server that it has reached its limit; the policy decides which requests to drop when that happens.

Useful signals include the number of concurrent requests in flight, queue length, the time a request has already spent waiting, CPU utilization and memory pressure. Queue waiting time is often the most reliable indicator, because it directly reflects whether a request can still be served before the client gives up.

StrategyHow it worksBest suited for
Concurrency limitRejects requests above a fixed number in flightServices with stable request costs
Queue timeoutDrops requests that waited longer than a thresholdWorkloads with strict client deadlines
Priority-based sheddingDrops low-priority traffic firstMixed critical and background traffic
Adaptive limitsAdjusts the limit from observed latencyVariable workloads and dependencies
Probabilistic droppingRejects a growing share as load risesSmooth degradation at large scale
Common load shedding strategies

Prioritization is what turns load shedding from a blunt tool into a precise one. A typical scheme keeps checkout, login and health checks at the highest priority and sheds analytics beacons, prefetch requests, crawlers and batch jobs first, so the most valuable work survives the overload.

Load shedding is one of several overload protection techniques, and it is often confused with rate limiting and circuit breaking. They differ in what triggers them and whom they protect.

TechniqueTriggerMain purpose
Load sheddingCurrent server overloadProtect the server from collapse
Rate limitingA client exceeds its quotaEnforce fair use per client
Circuit breakerA dependency keeps failingStop calling an unhealthy service
BackpressureDownstream cannot keep upSlow producers instead of dropping
AutoscalingSustained high utilizationAdd capacity over minutes
Graceful degradationOverload or partial failureServe reduced features
Load shedding and neighboring techniques

These techniques complement each other. Autoscaling cannot react within seconds, so load shedding protects the service while new instances boot. Redundancy, failover and N+1 capacity reduce how often shedding is needed, but no amount of spare capacity removes the need for a defined behavior when demand exceeds supply.

Where load shedding is implemented

Load shedding can be applied at several layers of the stack, and mature systems usually combine more than one. The closer to the edge a request is rejected, the less capacity it consumes.

  • Load balancers and reverse proxies can cap connections per backend and return 503 when all backends are saturated.
  • Application servers can limit worker pools and request queues, rejecting new work when they are full.
  • Service frameworks and meshes often provide adaptive concurrency limits that react to latency changes.
  • Databases enforce connection limits and statement timeouts, which act as a last line of shedding.

A rejected response should be cheap to produce and informative. Returning 503 with a Retry-After header tells well-behaved clients when to try again, and clients should combine it with exponential backoff and jitter so that retries do not arrive in synchronized waves.

Common mistakes when applying load shedding

The most frequent mistake is setting thresholds without load testing. A limit set too low wastes capacity and rejects users unnecessarily, while a limit set too high activates only after the server is already collapsing.

  • Shedding too late, after expensive work such as authentication or database queries has already been done.
  • Treating all traffic equally, so that critical transactions are dropped as often as background requests.
  • Ignoring retries, which lets rejected clients return immediately and amplify the overload.
  • Missing monitoring, so that shed requests are not counted and the team does not see the overload at all.

Shed requests should be tracked as a dedicated metric and alerted on, because a rising rejection rate is an early signal that capacity planning or redundancy needs attention. Teams commonly verify their shedding behavior with load tests and chaos engineering exercises before relying on it in production.

The simple explanation

Load shedding is what a server does when too many people ask for something at once. Instead of trying to serve everyone and failing everyone, it politely turns some requests away so it can serve the rest properly.

Think of a popular restaurant on a busy night. If it seats every guest who walks in, the kitchen falls behind and nobody gets a meal on time. A good host stops seating new guests when the kitchen is full. Some people wait or come back later, but those inside get their food.

How it is used in practice

A ticketing platform expects heavy demand when a popular concert goes on sale. Load tests show that each application server handles about 400 concurrent requests before response times rise sharply, so the team sets a concurrency limit of 350 requests per server and configures the reverse proxy to return 503 with a Retry-After header when the limit is reached.

Traffic is also split into priority classes: payment and checkout calls receive the highest priority, seat-map browsing the middle one, and recommendation widgets and analytics the lowest. When sales open, incoming traffic reaches about three times the planned capacity. The servers shed most analytics and recommendation calls and part of the browsing traffic, while checkout latency stays under 300 ms and no server crashes. Autoscaling adds capacity over the next ten minutes, and the rejection rate falls back to zero.