Try
↑ ↓ move↵ openesc close

Interview prep / Connections and head-of-line blocking

Mid · Connections and head-of-line blocking · System design interview question

An HTTP/1.1 client sends 200 requests a second and each takes 90 ms. How do you size the pool?

Sketch your own answer first, then compare it with the one below.

A strong answer

Use the rate times the time in the system. 200 per second times 0.09 seconds is 18 requests in service at once, so the pool needs at least 18 connections. Add headroom for bursts and slower responses, so a size near 24 is reasonable.

Below the needed size, the queue grows without bound while the load lasts, and latency climbs with it. Above it, extra connections cost memory. The shortfall matters more than the surplus.

Also say that this is an average. Check the 99th percentile, and watch the queue length, because it shows the problem first.

Sources

Learn it by running it

The connections and head-of-line blocking lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms