principlejavascriptTip
HTTP/2 Multiplexing Eliminates Head-of-Line Blocking at the HTTP Layer
Viewed 0 times
http2http3multiplexingquichead-of-line blockingperformance
Problem
HTTP/1.1 pipelining never worked well in practice because a slow response blocks all subsequent responses on that connection (HTTP-layer head-of-line blocking). Developers worked around it with domain sharding and request bundling, which are antipatterns under HTTP/2.
Solution
HTTP/2 sends all requests and responses as binary frames on a single TCP connection. Streams are independent — a slow stream does not block others at the HTTP layer.
HTTP/3 (QUIC) goes further and eliminates TCP-layer head-of-line blocking by using UDP with per-stream reliability.
HTTP/3 (QUIC) goes further and eliminates TCP-layer head-of-line blocking by using UDP with per-stream reliability.
// With HTTP/2 these fire in parallel over one connection
// No need for domain sharding or bundling tiny files
const [a, b, c] = await Promise.all([
fetch('/api/users'),
fetch('/api/products'),
fetch('/api/orders')
]);Why
Under HTTP/1.1, browsers open 6 connections per origin to fake parallelism. HTTP/2 needs only one, making domain sharding actively harmful (it prevents multiplexing).
Gotchas
- HTTP/2 head-of-line blocking at TCP layer still exists — a dropped TCP packet stalls all streams. HTTP/3/QUIC fixes this.
- HTTP/2 server push was deprecated by Chrome in 2022 — use
<link rel=preload>instead. - Many Node.js HTTP servers (Express) don't natively support HTTP/2 — use the
http2module or a reverse proxy.
Revisions (0)
No revisions yet.