Real-time updates
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 · 8 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.

    What does polling cost a million online users?

      How many WebSocket gateways for a million users?

        How much pub/sub traffic do 5,000 messages a second make?

          How do you send 2,000 comments a second to a million viewers?

            Build-up · 6 steps

            Deliver a message across gateways

            One chat message from Asha to Ravi. Each step answers what breaks once there is more than one gateway, and what it costs.

            Step 1 of 6

            One gateway

            Asha and Ravi hold WebSockets to the same gateway, so it writes Asha’s message straight to Ravi’s socket. Easy, until you run a second gateway.

            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 food-delivery app shows live order status and the rider on a map. Which last mile do you pick?”

              Your move. Pick an approach:

            2. Deep dive 2 of 4

              Interviewer

              “Gateways must hear about every chat message. What carries it, and what is the source of truth?”

              Your move. Pick an approach:

            3. Deep dive 3 of 4

              Interviewer

              “A channel has 10,000 members. Do you publish to per-user topics or one per-room topic?”

              Your move. Pick an approach:

            4. Deep dive 4 of 4

              Interviewer

              “A gateway holding 50,000 sockets crashes in the afternoon. How should its clients come back?”

              Your move. Pick an approach: