HTTP/2 vs HTTP/1.1

One connection, many streams

L215 MINNETWORKING
PREDICT

24 resources, 6 HTTP/1.1 connections, a 100 ms round trip, fast server. Roughly how long until the last response arrives?

HTTP/1.1 carries one request at a time per connection. Browsers open about six connections per origin, and request seven waits in a queue for one of them. A slow response, like an API call that takes 200 ms to compute, ties up its connection the whole time. That is head-of-line blocking at the HTTP layer.

HTTP/2 sends every request at once on one connection. Each is a stream, and responses are cut into frames that interleave on the wire. The server picks which stream’s frame goes next. The catch: all streams share one TCP byte stream, so a lost packet stalls them all.

▶ SIMULATION
pageHTML parsed at t = 0; 24 resources to fetch; RTT 100 ms; one 5 ms frame on the link per tick
✓ page loads within 4 RTT (400 ms)
SCHEDULE
01[BROWSER]HTTP/1.1: 6 connections, one request in flight on each
02[CLOCK]run to t = 100 ms (1 RTT)
03[CLOCK]run to t = 200 ms (2 RTT)
04[CLOCK]run to t = 300 ms (3 RTT)
05[CLOCK]run to t = 400 ms (4 RTT)
06[CLOCK]run to t = 500 ms (5 RTT)
07[CLOCK]run to t = 600 ms (6 RTT)
08[CLOCK]run until the page has loaded
Start of http/1.1 × 6 scenario. 8 steps.
HTTP/1.1 (RFC 9112)
  One request in flight per connection. Pipelining exists but is unused
  in browsers, so a slow response occupies its connection until it ends.
  Browsers open ~6 connections per origin; request 7 waits in a queue.

HTTP/2 (RFC 9113)
  One TCP connection, many streams (client streams use odd ids: 1, 3, 5 …).
  Requests and responses are split into frames (HEADERS, DATA, …) that
  interleave on the wire. The sender picks which stream's frame goes next,
  so a slow response no longer blocks the others at the HTTP layer.
  HPACK compresses repeated headers.

  Server push (PUSH_PROMISE): deprecated in practice. Chrome removed it in
  2022; most servers and CDNs disable it. Use 103 Early Hints / preload.
  The RFC 7540 priority tree is deprecated in RFC 9113; RFC 9218
  (Extensible Priorities, the "priority" header) replaces it.

What HTTP/2 does NOT fix
  TCP delivers bytes in order. One lost segment stalls every stream on the
  connection until it is retransmitted: head-of-line blocking moved down a
  layer. HTTP/3 runs streams over QUIC, which orders bytes per stream.

Watch the invariant strip and the DOWNLINK box. HTTP/1.1 runs out of connections and blows the 4 RTT budget. HTTP/2 meets it with the same page. HTTP/2, NO MULTIPLEXING shows that the win comes from the frame scheduler: write responses in order and the link sits idle behind /api/feed. HTTP/2 + 1 LOST PACKET still meets the budget, but count the streams held back by one lost frame.

TUNE IT NOT YET

HTTP/1.1 with 6 connections. Find the largest RESOURCES count at which the page still loads within the 4 RTT budget, so that one more resource breaks it.

GOAL: HTTP/1.1 meets the budget at RESOURCES but not at RESOURCES + 1

FIX IT NOT YET

You write the HTTP/2 server's frame scheduler. Each tick it is called with every stream and the id it sent last; return the id of the stream whose next DATA frame goes on the wire, or null if nothing is ready. A stream with ready: false is still waiting on the backend. Never let one stream (slow or large) hold back the others, and never leave the link idle while a ready stream has frames left. Round-robin is one policy that does this; it is not the only one. Real clients can also ask for sequential delivery with RFC 9218 priorities.

Mental model:

HTTP/1.1 pays a round trip per request per connection, so more resources means more round trips. HTTP/2 pays one round trip for all of them and lets the server interleave responses, so a slow one no longer blocks the rest. It does not fix the layer below: one TCP connection is still one ordered byte stream, and a lost packet stalls every stream on it.

IN PRODUCTION

Waterfall charts in browser dev tools (the six-wide staircase is HTTP/1.1), domain sharding and sprite sheets (HTTP/1.1 workarounds that hurt under HTTP/2), CDN and load balancer HTTP/2 settings, and HTTP/3 rollouts justified by mobile packet loss.

IN INTERVIEWS

“What does HTTP/2 improve over HTTP/1.1, and what problem remains?” Cover multiplexing over one connection, binary framing and HPACK, why six connections only divide the round trips, that server push is effectively dead, and that TCP-level head-of-line blocking is why HTTP/3 moved to QUIC.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: BGP ROUTE HIJACKING →