Try
↑ ↓ move↵ openesc close

Interview prep / Load shedding and backpressure

Mid · Load shedding and backpressure · System design interview question

What is deadline-aware dropping, and what does it need from the rest of the system?

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

A strong answer

When a worker takes the next request from the queue, the server checks whether the request can still finish before its caller gives up. If the time left is less than the expected service time, the server drops it without doing the work. Dropping is nearly free, so the worker moves straight on to a request that can still succeed.

It needs to know the deadline. The client has to send it, as a timeout or an absolute time, and every hop has to pass on the time that is left rather than start a fresh timeout. Without that, a service deep in a call chain keeps working on requests that the first caller dropped long ago.

It also needs a rough estimate of service time. If the estimate is too low, some requests start and finish late. If too high, some that could have made it are dropped.

The advantage over a fixed queue bound is that there is no size to tune. The deadline of each request decides. The cost is the plumbing for deadlines, and the risk that a deadline is not the real one.

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