Connection pools and head-of-line blocking lab
Send requests over a pool of connections. Compare handshakes on every request with reuse, a pool that is too small, HTTP/1.1 with HTTP/2, and what packet loss does to streams that share one TCP connection and to QUIC.
tick 100 (1 tick = 10 ms)HTTP/2 over TCP, pool 450 ms round trip, 1% loss
Latency
- completed
- 165
- median
- 150 ms
- 99th percentile
- 350 ms
- waiting for a connection
- 0
Latency counts from the moment a request arrives, so time spent waiting for a free connection and time spent in a handshake are both included.
Connections and loss
- connections opened
- 4
- requests in flight
- 35
- loss events
- 27
- held by another stream's loss
- 56%
On TCP, one lost packet holds back every stream on that connection until the retransmit arrives. The share below is requests that finished late because of someone else's loss.
| Series | Latest | Lowest | Highest |
|---|---|---|---|
| latency (ms) | 156 | 0 | 240 |
| queue (requests) | 0 | 0 | 0 |
After 100 ticks, 165 requests finished with a median of 150 ms and a 99th percentile of 350 ms. 4 connections were opened. 0 requests are waiting for a connection, and 56% of finished requests were held back by another stream's packet loss.
What to try
Each one sets up a starting point. Then make the change it describes.
A handshake for every request
Switch to a new connection per request, with HTTP/2 and no packet loss.
Look for. Every request now waits for the TCP and TLS handshakes, two round trips, before it sends anything. Median latency roughly doubles at this round trip time, and the number of connections opened explodes.
A pool that is too small
Choose HTTP/1.1, no loss, and a pool of 8 connections.
Look for. Each connection serves one request at a time, so 8 connections cannot keep up with 200 requests a second. Requests queue and latency grows without bound. A pool near 24 is enough.
Multiplexing removes the queue
Choose HTTP/2 with no loss and a pool of 4.
Look for. Four connections carry all the requests at once, because streams share them. The queue is empty and latency is one round trip plus the work.
One loss stalls everyone
Choose HTTP/2 with a pool of 1 and 2 percent loss.
Look for. A lost packet holds back every stream on the connection until the retransmit lands. Most requests finish late because of loss on a different stream. The 99th percentile climbs by an order of magnitude.
The same loss over QUIC
Keep the pool at 1 and 2 percent loss, and choose HTTP/3.
Look for. Only the stream that lost the packet waits. Other streams keep going, and no request is held back by someone else's loss.
New to the idea? Read the lesson first. Every number here comes from a seeded simulator, so the same seed gives the same run.
Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms