Improper instantiation
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.

    What does a new client cost per call at a 30 ms round trip?

      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.

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

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

            3. Deep dive 3 of 4

              Interviewer

              “After sharing one HttpClient, a teammate sets DefaultRequestHeaders.Authorization before each call. What goes wrong?”

              Your move. Pick an approach:

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