Multiplexing, pools and HTTP latency
medium 7 minA client may spend part of its deadline waiting for a connection or stream before sending a byte.
Video lesson · Chapter 1 of 4
A pool queue mistaken for server latency
Theory
Read or listen first. About 2 min.
What it is
A client may spend part of its deadline waiting for a connection or stream before sending a byte. HTTP/1.1 pools reuse connections, while HTTP/2 multiplexes streams on one TCP connection. TCP delivers an ordered byte stream, so missing bytes can delay multiple streams. QUIC separates stream delivery while streams still share path capacity.
Why it exists
After introducing a streaming response, short requests slow down. Application traces at the origin stay fast. Instrument pool acquisition, connection setup and response time separately. A few long-lived calls can occupy all available slots. Raising the limit moves load downstream, so measure origin headroom or reserve separate capacity for streaming traffic.
If leases arrive promptly, instrument DNS, handshake and server work separately and compare cold versus reused connections.
A pool queue mistaken for server latency
Inside this chapter
- HTTP/1.1: Keep-alive and Pipelining
- Persistent HTTP/1.1 connections avoid repeated setup. Pipelined responses retain ordering constraints. Multiple connections can provide concurrency at the cost of more sockets and handshakes.
- HTTP/2: Multiplexing, Header Compression (HPACK), Stream prioritization
- HTTP/2 carries interleaved frames for streams and compresses headers with HPACK. Streams share TCP delivery and connection-level resources. Priority behavior depends on peers and protocol versions.
- HTTP/3 (QUIC): UDP-based transport and eliminating Head-of-Line blocking
- HTTP/3 uses QUIC streams over UDP. Loss on one stream need not block delivery of another stream’s available bytes, although path congestion and connection-level limits remain shared.
- HTTP Connection Pooling
- A pool bounds open connections or streams and amortizes setup. Track acquisition wait, active leases and release paths so client-side queuing is visible.
- HTTP Caching Headers: Cache-Control, ETag, Last-Modified
- Cache-Control sets reuse policy and freshness. ETag and Last-Modified enable validation. Correct cache keys and variation rules matter when users receive different representations.
- HTTP Compression: gzip, brotli, zstd
- Content encoding trades CPU work for fewer wire bytes. Negotiate encodings with the client and measure total latency on both small and large responses.
- gRPC and Protocol Buffers
- gRPC commonly maps RPCs to HTTP/2 streams and serializes typed messages with Protocol Buffers. A deadline, cancellation and schema compatibility are part of the service contract.
How it works
Step through the idea, or press Play.
Create the pool. This client opens reusable connections up to a configured capacity.
Understand it
Worked incident
A pool queue mistaken for server latency
| Observation | Pool acquisition p95 (ms) | Interpretation |
|---|---|---|
| Baseline | 3 | Short calls obtain a slot immediately. |
| Incident | 240 | Streaming requests retain slots and wait time accumulates ahead of the origin. |
| After intervention | 6 | Separate the traffic classes or right-size the pool. Verify client and origin latency together. |
Choose the next investigation
Summary
The whole topic in one minute.
A request can spend its deadline entirely on the client side before a server span exists.
If leases arrive promptly, instrument DNS, handshake and server work separately and compare cold versus reused connections.