Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. The cost before the first byte
  2. 2. Handshakes and connection pools
  3. 3. Pool size, protocol and packet loss
  4. 4. A pool that is too small
  5. 5. HTTP/1.1 against HTTP/2
  6. 6. Head-of-line blocking and QUIC
  7. 7. Connections in review

Topic 3

Pool size, protocol and packet loss

8 min read

What the lab runs

Requests arrive at a rate you choose. A tick is 10 ms. Each request needs one round trip plus 40 ms of server work and sending ten packets. You choose the protocol, the pool size, the round trip time and the chance that any one packet is lost.

With HTTP/1.1 a connection carries one request at a time. With HTTP/2 and HTTP/3 a connection carries many at once. On a loss, TCP stalls every stream on that connection until the retransmit arrives. QUIC stalls only the stream that lost the packet.

The lab reports median and 99th percentile latency, the queue of requests waiting for a connection, how many connections were opened, and the share of requests that finished late because of another stream’s loss.

Predict before you press play

With HTTP/1.1 at 200 requests a second, each taking about 90 ms, how many connections are needed to avoid queuing?

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.

Mean latency of requests finishing each tick, and queue length, last 150 ticks
Mean latency of requests finishing each tick, and queue length, last 150 ticks. Text version available below the chart.0125250375500151100recent ticksms or requests

Full-page version with guided experiments: Connection pools and head-of-line blocking lab.

Things to try

  1. Switch to a new connection per request, with HTTP/2 and no loss.
  2. Choose HTTP/1.1, no loss, and a pool of 8.
  3. Choose HTTP/2 with no loss and a pool of 4.
  4. Choose HTTP/2 with a pool of 1 and 2 percent loss.
  5. Keep that and choose HTTP/3.

The full-page lab has a guided experiment for each of these.

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