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 new connections a second can one host make to one destination?
How fast does a NAT gateway run out of ports?
What does a shared, recycled pool cost instead?
Build-up · 6 steps
One client per process, not per call
A payments service calling a bank 30 ms away. First see what a per-request client costs the host and the NAT, then fix it and pay for sharing.
Step 1 of 6
A client per request
Every call builds a client with an empty pool, so it pays DNS, TCP and TLS before the request, 92 ms instead of 30.
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 .NET payments service creates an HttpClient in a using block for every call to the bank. What do you change?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“A Lambda builds an S3 client and a Session per invocation. In a sale, 1,000 environments run 10 a second each. Fix?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“A Go service shares one http.Client, yet it reconnects after every burst of 50 concurrent calls to one host. What do you change?”
Your move. Pick an approach: