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.
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.
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:
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:
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:
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: