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.
A new user in Mumbai, origin in Virginia. How long to the first byte?
A service calls a downstream 5,000 times a second. How many TLS handshakes?
Build-up · 5 steps
Count the round trips before the first byte
A brand-new connection at 50 ms RTT, ignoring DNS and server think time. Each block is one round trip; the blue block is the request.
Step 1 of 5
Plain HTTP, the baseline
TCP’s handshake costs one round trip, then the GET costs another. The first byte arrives at 100 ms, with nothing encrypted.
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 customer’s
POST /paymentstimes out. The mobile team wants the HTTP client to retry it automatically. What do you tell them?”Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“Most of your users are on lossy mobile networks and hop between Wi-Fi and mobile data. Which HTTP version do you serve?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Users in Mumbai, origin in Virginia at about 200 ms RTT. New connections make even uncacheable API calls slow. What do you change?”
Today the origin terminates TLS 1.2 over TCP.
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Behind an AWS Application Load Balancer, a trickle of requests fail with 502, though every backend is healthy. What do you change?”
Your move. Pick an approach:
Build-up · 5 steps
Lose one packet under each HTTP version
Streams 1, 3 and 5 share the line, and one stream 3 packet goes missing. What has to wait for the resend?
Step 1 of 5
HTTP/1.1: a lane each
One response in flight per connection, so browsers open about 6 per origin. A loss on connection 2 stalls only connection 2, but every lane pays its own handshake.