Scrivio Interview library
ConceptFoundations6 min read · updated 13 November 2026

When more requests arrive than a service can handle, something has to give. Load shedding is a server deliberately rejecting part of the work early so that the rest is served well, instead of letting every request slow down together.

How does load shedding differ from rate limiting and back-pressure, why should rejected requests fail fast with a clear status, and what should a client do when it receives one?

Rate limiting enforces an agreed limit per client whatever the server's health, load shedding reacts to the server's own state and rejects what exceeds current capacity, and back-pressure tells a producer to slow down where the protocol allows it. Rejections should be early and clear, HTTP 503 with a Retry-After header, or 429 for a client over its quota, because a request turned away early costs microseconds while one that times out wastes a thread, a connection and CPU. Clients should retry with exponential backoff and jitter within a retry budget and only for idempotent operations, and servers should shed by priority so the most important work survives.

Why this question is asked

Every service has a maximum rate it can handle, and sooner or later traffic exceeds it, through a promotion, a retry storm or a failure elsewhere. What happens then decides whether a few users see an error or all users see a timeout. Interviewers ask about load shedding because it is often confused with rate limiting and back-pressure, and because the client side, how to react to a rejection, is just as important as the server side. In this answer, we will separate the three ideas, see why early rejection is so much cheaper than a timeout, choose the right status codes, describe how clients should retry, and add priorities.

1Three Ideas That Sound Alike

Rate limiting enforces an agreement. Each client or API key may make, say, 100 requests per second, and the limit applies whether the server is idle or busy. Its purpose is fairness and protection from one heavy client. Load shedding reacts to the server's own state. The server measures in-flight requests, queue time or CPU, and when it is at capacity, it rejects the excess, from whoever it comes. Its purpose is to keep the server healthy. Back-pressure is a signal to the producer to slow down, built into the protocol: a reactive stream requests only as many items as it can process, a Kafka consumer simply fetches less, and TCP flow control slows the sender. Its purpose is to match speed without losing work.

So rate limiting is about clients, load shedding is about the server's capacity, and back-pressure is about flow between a producer and a consumer that can talk to each other. HTTP request/response traffic from many independent clients offers little back-pressure, which is why load shedding is needed there.

Rate limiting, load shedding and back-pressure
Triggered byApplies toTypical response
Rate limitingClient exceeds its agreed quotaOne client or key429 Too Many Requests
Load sheddingServer at capacityExcess requests, lowest priority first503 Service Unavailable
Back-pressureConsumer cannot keep upProducer in a stream or queueProducer slows down

2Why Rejecting Early Is So Much Cheaper

When a server is overloaded, every request it accepts competes with every other one. A request that is accepted, parsed, sent to the database, and then times out after 2 seconds held a thread, a database connection and CPU for all that time, and produced nothing useful. Worse, it slowed down every other request while it ran.

A request rejected at the door, before parsing or any database call, costs a few microseconds and frees the server to give its full capacity to the requests it accepted. So if a server can handle 1,000 requests per second and receives 1,300, shedding 300 early keeps 1,000 users served at normal latency. Without shedding, all 1,300 slow down together, many time out, and the server may complete far fewer than 1,000 useful requests.

3Fail Fast With a Clear Status

A rejection should say clearly what happened and when to try again. For load shedding, the status is 503 Service Unavailable, which tells clients and gateways the failure is temporary and on the server side. For a client over its own quota, the status is 429 Too Many Requests. Both should carry a Retry-After header, in seconds, telling the client when a retry makes sense.

YAML
HTTP/1.1 503 Service Unavailable
Retry-After: 2
Content-Type: application/problem+json
{"type": "https://example.com/problems/overloaded",
"title": "Service is overloaded", "status": 503}

Notice what we avoid: returning a 500, which suggests a bug, or letting the request hang until a timeout, which wastes both sides' resources and tells the client nothing. A fast, clear 503 lets a load balancer try another instance and lets a client back off sensibly.

4What a Client Should Do With a Rejection

The client's reaction decides whether shedding works. If every rejected client retries immediately, the rejected load comes straight back, plus the new load, and rejections turn into a retry storm. So clients retry with exponential backoff, waiting longer after each failure, such as 200 ms, 400 ms, 800 ms, and with jitter, a random amount added to each wait, so thousands of clients do not retry in the same instant. They honour Retry-After when it is present.

Clients also keep a retry budget, for example retries may add at most 10 percent to the requests they send, and they only retry idempotent operations, those that are safe to repeat, such as reads, or writes protected with an idempotency key. A payment submitted without an idempotency key should not be retried blindly.

Java
long backoff(int attempt, Duration retryAfter) {
long base = Math.min(200L << attempt, 5_000); // 200, 400, 800 ... capped at 5 s
long jittered = ThreadLocalRandom.current().nextLong(base + 1); // full jitter: 0..base
return retryAfter != null ? Math.max(jittered, retryAfter.toMillis()) : jittered;
}
// attempt 0 -> 0..200 ms, attempt 3 -> 0..1600 ms, never before Retry-After

5Shed by Priority

Random shedding treats a login and a background prefetch the same. That is wasteful, because some requests matter much more than others. Where possible, requests carry a priority, set by the gateway from the route or the client type, and the server sheds the lowest priority first: prefetches, analytics and background refreshes go before browsing, and browsing goes before logins and payments.

With priorities, a heavily overloaded service can still complete nearly all of its most important work, and users see missing recommendations rather than failed checkouts.

6Follow-up questions

Which signal would you use to decide when to start shedding?

The most reliable signals measure the work in the server directly: the number of in-flight requests compared with a concurrency limit, or the time requests spend queued before a worker picks them up. Queue time is especially good, because it rises sharply exactly when the server falls behind and is independent of how expensive each request is. CPU alone is a weaker signal, since a service can be overloaded on a database pool or I/O while CPU looks fine. Many teams use a concurrency limit, adjusted from measured latency by an adaptive algorithm, as the main trigger.

Is shedding the same as a circuit breaker?

No. A circuit breaker runs on the caller and stops calling a dependency that is failing. Load shedding runs on the server and protects it from too much work. They complement each other: the server sheds, and callers that see many rejections open their breakers and back off.

Should the load balancer shed instead of each instance?

Both can help. The balancer can cap connections, but only each instance knows its own queue time and in-flight work, so the final decision is best made in the service.

7Conclusion

In this answer, we separated rate limiting, which enforces per-client agreements, from load shedding, which protects the server's capacity, and back-pressure, which slows producers in streams and queues. We saw why early rejection is far cheaper than a timeout, used 503 or 429 with Retry-After, made clients back off with jitter within a retry budget for idempotent operations, and shed by priority.

What to say in the interviewAbout 80 seconds aloud

Open with

These three get confused, but they react to different things. Rate limiting enforces an agreed limit per client or key, say 100 requests per second, no matter how healthy the server is.

Then, if they want more

Load shedding reacts to the server's own state, in-flight requests, queue time or CPU, and rejects whatever exceeds current capacity. Back-pressure is a protocol signal telling a producer to slow down, as in reactive streams, Kafka consumers or TCP, which plain HTTP from many clients mostly lacks.

Rejections should be early because an early rejection costs microseconds, while a request that is accepted and then times out holds a thread, a connection and CPU for seconds, produces nothing, and slows down everyone else. So if a server handles 1,000 a second and gets 1,300, shedding 300 early keeps 1,000 people served well.

The response should be a 503 for shedding, or a 429 for a client over quota, with a Retry-After header, so clients and gateways know it is temporary. Clients then retry with exponential backoff and jitter, honour Retry-After, stay within a retry budget and only retry idempotent operations, otherwise rejections become a retry storm.

And where we can, we shed by priority, so prefetches and background refreshes go first and logins and payments survive.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "How does load shedding differ from rate limiting and back-pressure, why should rejected...": https://scrivio-interview-library.netlify.app/architecture/high-availability/22bb52ec89/