Backpressure
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 6 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Build-up · 4 steps

    A tatkal spike, with and without a bound

    200 workers at 50 ms a request serve 4,000 a second. Traffic jumps from 3,000 to 6,000 a second for 10 seconds, and the app times out after 2 seconds.

    Step 1 of 4

    Capacity meets the spike

    The queue grows by 6,000 − 4,000 = 2,000 a second. A request arriving at second t waits t ÷ 2 seconds.

    4 interview moments

    You’re the candidate

    The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

    1. Deep dive 1 of 4

      Interviewer

      “Tatkal opens. Traffic jumps from 3,000 to 6,000 a second for 10 seconds against a capacity of 4,000. What sits in front of the workers?”

      Your move. Pick an approach:

    2. Deep dive 2 of 4

      Interviewer

      “A sale overloads the order service and it must shed. Which requests should go first?”

      Your move. Pick an approach:

    3. Deep dive 3 of 4

      Interviewer

      “Requests are cheap RAM lookups, so rejecting one costs nearly as much as serving it. The backend overloads saying no. What helps?”

      Your move. Pick an approach:

    4. Deep dive 4 of 4

      Interviewer

      “A fixed concurrency limit of 200 was right last year. Code, hardware and dependencies have changed since. What now?”

      Your move. Pick an approach:

    Build-up · 4 steps

    A queue that sets its own timeout

    A CoDel-style queue with adaptive LIFO, as described in “Fail at Scale”. The front of the queue, served next, is on the right.

    Step 1 of 4

    Calm, so FIFO

    The queue emptied within the last 100 ms, so it is absorbing a burst. New requests join the back and may wait up to 100 ms.