Concurrency
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 · 9 min

    Go deeper

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

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How many requests a second can one core serve?

      What does each model cost for 50,000 idle WebSockets?

        How much faster does a report job with 10% serial work get?

          Build-up · 5 steps

          Fill one core with waiting requests

          An order-history API needs 5 ms of CPU and 95 ms of waiting per request. Watch concurrency fill the idle core, then find what caps it.

          Step 1 of 5

          One request at a time

          Each request needs 5 ms of CPU, then waits 95 ms. One at a time, the core serves 10 a second and sits idle 95% of the time.

          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

            “A delivery-tracking gateway must hold 50,000 WebSockets, each idle except for a location update every few seconds. How do you structure it?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “Your menu API serves 2,000 requests a second at 100 ms, thread per request. A teammate proposes an async rewrite for speed. Agree?”

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “Thumbnail jobs take 200 ms of pure CPU on 8 cores, and the queue keeps growing. What do you change?”

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “Two deposits to one wallet each read the balance, add and write back, and one vanishes. How do you fix it?”

            Your move. Pick an approach: