Try
↑ ↓ move↵ openesc close

Interview prep / Load shedding and backpressure

Senior · Load shedding and backpressure · System design interview question

A service handles checkout, search and background prefetch on the same fleet, and it is overloaded. How do you decide what to shed?

Sketch your own answer first, then compare it with the one below.

A strong answer

Shed by importance, not at random. Give each request a criticality when it enters the system, and carry it with the request through every hop. Under overload, the service first rejects the least critical class, then the next, and keeps the most critical class until the very end.

Make the signal that triggers shedding something that tracks the real problem. Queue delay, concurrency in flight, or CPU are better than request rate, because requests differ in cost. Take care with a metric that feeds back on itself: if shedding lowers it, shedding stops, load returns and it starts again. Use some hysteresis.

Do it at the cheapest point, which is as early as possible and before expensive work. Let the callers help. If a caller sees many rejections from a backend, it can throttle itself on the client side, so most of the rejected traffic never leaves it.

Plan for the sum of retries too. Rejected clients that retry add load, so use Retry-After, backoff, and retry budgets.

Test it the way it fails: replay a load spike in staging and check that checkout survives while prefetch is the first thing to go.

Sources

Learn it by running it

The load shedding and backpressure lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms