What it is
HTTP/2 (RFC 9113) and HTTP/3 (RFC 9114) keep HTTP’s semantics — methods, status codes, headers — and change how messages travel. HTTP/2 multiplexes many request/response streams over one TCP connection using binary frames. HTTP/3 does the same over QUIC (RFC 9000), a transport built on UDP that provides reliability, congestion control and streams itself and integrates TLS 1.3.
Why it exists
HTTP/1.1 sends one request at a time per connection and the response must come back before the next request (pipelining exists but was never usable in browsers). Pages load dozens of resources, so browsers opened up to six connections per host and sites added hostnames (domain sharding) to get more. Every connection pays its own TCP and TLS handshakes, starts with a small congestion window and competes with its siblings. HTTP/2 removed the need for multiple connections; HTTP/3 then removed the remaining transport-level problems that TCP imposes.
How it works
HTTP/2. Each request and response is split into HEADERS and DATA frames carrying a stream ID (client streams are odd: 1, 3, 5…). Frames from different streams interleave on one connection, so a slow response does not block others at the HTTP layer. HPACK compresses headers with static and dynamic tables, so repeated cookies and user agents cost a few bytes. Flow control works per stream and per connection; the server limits concurrency with SETTINGS_MAX_CONCURRENT_STREAMS (commonly 100 or more). Server push was specified but browsers removed support; 103 Early Hints is the replacement.
TCP head-of-line blocking. TCP delivers an ordered byte stream. If one segment is lost, everything after it waits in the receive buffer until the retransmission arrives — even frames belonging to other streams that are complete. On a clean network this is rare; on lossy Wi-Fi or mobile links one loss stalls every stream on the connection for at least a round trip.
QUIC and HTTP/3. QUIC runs in user space over UDP. Streams are a transport concept: each has its own ordering, so a loss delays only the stream whose data was lost. The QUIC handshake carries TLS 1.3, so a new connection is ready after one round trip (TCP + TLS 1.3 need two); resumed connections can send 0-RTT data. Packet headers are mostly encrypted, which stops middleboxes from depending on (and ossifying) transport details. HTTP/3 uses QPACK instead of HPACK, designed so header compression does not reintroduce cross-stream blocking.
Connection migration. A TCP connection is identified by source/destination address and port. When a phone changes networks, its address changes and the connection is dead. QUIC identifies connections by connection IDs; a client can continue from a new address after the server validates the path (PATH_CHALLENGE/PATH_RESPONSE). Load balancers in front of QUIC servers must route by connection ID (e.g. encoding a server ID in it) for this to work.
Discovery and fallback. A client does not know in advance that a server speaks HTTP/3. Servers advertise it with the Alt-Svc: h3=":443" response header or a DNS HTTPS record (RFC 9460) carrying alpn=h3. Browsers race QUIC against TCP and fall back to HTTP/2 when UDP is blocked or slow.
When to use it
- Serve HTTP/2 everywhere TLS is used; it is the baseline for browsers and gRPC.
- Add HTTP/3 at the edge (CDN, load balancer) for user-facing traffic, especially mobile and lossy networks, and for clients that move between networks.
- gRPC is built on HTTP/2 streams; long-lived streaming APIs benefit from multiplexing.
When not to
- HTTP/3 inside a data centre rarely pays off: loss is low, connections are long-lived, and kernel TCP with offloads is cheaper per byte than user-space QUIC.
- HTTP/1.1 remains fine for simple internal calls, health checks and tooling; many proxies still speak HTTP/1.1 to origins.
- Do not rely on HTTP/3 alone: some networks block UDP.
Trade-offs
| Choice | You gain | You pay |
|---|---|---|
| HTTP/2 instead of many HTTP/1.1 connections | One handshake, shared congestion control, header compression | Transport head-of-line blocking on loss; one connection carries everything |
| HTTP/3 instead of HTTP/2 | One-round-trip setup, per-stream loss recovery, migration | More CPU per byte, UDP may be blocked, newer tooling, QUIC-aware load balancing |
| 0-RTT on QUIC | First request in the first flight | Replay risk for non-idempotent requests |
Alternatives
- HTTP/1.1 with keep-alive for simple clients and internal hops.
- WebSockets (over HTTP/1.1, or HTTP/2 and HTTP/3 via extended CONNECT) for bidirectional messaging; Server-Sent Events for one-way streams (see those lessons).
- WebTransport over HTTP/3 for low-latency bidirectional streams and unreliable datagrams in browsers.
Failure modes
- Lossy links with HTTP/2: one connection means one loss stalls all streams; at high loss rates multiple HTTP/1.1 connections can even outperform a single HTTP/2 connection.
- Concurrency limits: a low
MAX_CONCURRENT_STREAMSor connection-level flow-control window throttles throughput silently. - Abuse of multiplexing: rapid stream creation and cancellation (the 2023 “Rapid Reset” attack) can overload servers; keep proxies patched and limit stream churn.
- UDP blocked or rate-limited: HTTP/3 attempts stall until fallback kicks in.
- Load balancers unaware of QUIC: migrated or 0-RTT packets reach the wrong backend.
In production
Terminate HTTP/2 and HTTP/3 at the CDN or load balancer; most managed edges support both. Advertise HTTP/3 with Alt-Svc and HTTPS DNS records. Keep TCP available. Use HTTP/2 or HTTP/1.1 with keep-alive and connection pools to the origin. Drop HTTP/1.1 hacks (domain sharding, spriting, inlining everything) that hurt under multiplexing. Monitor protocol mix, handshake times and retransmission rates per network type.
Common misconceptions
- “HTTP/2 fixed head-of-line blocking.” At the HTTP layer, yes; at the TCP layer, no.
- “QUIC is unreliable because it uses UDP.” QUIC implements reliable, ordered streams itself; UDP only carries its packets.
- “HTTP/3 makes every request faster.” It mainly helps setup latency and lossy or changing networks; on clean, warm connections the difference is small.
- “Server push is how HTTP/2 speeds up pages.” Browsers removed push; 103 Early Hints and preload replaced it.
Interview angle
When designing a user-facing API or site, say which protocol you serve at the edge (HTTP/2 + HTTP/3 with TCP fallback) and what you use to the origin. Explain head-of-line blocking at both layers in one sentence each, count round trips for new connections (two for TCP + TLS 1.3, one for QUIC), and mention connection migration for mobile clients. For real-time features, connect this to WebSockets, SSE or WebTransport.
Model assumptions
This lesson is a scripted walk-through, not a simulation: the engine has no TCP, QUIC or packet-loss model, so every packet is placed by hand to show order and timing. One-way latency is 10 ms from the phone to the Wi-Fi or cellular network and 10 ms on to the server (40 ms round trip); handing data from the phone’s transport stack to the page is drawn as a 2 ms hop. Each response is two frames per stream. Loss recovery is drawn as fast retransmission after three later packets are acknowledged; real stacks also use timers, and real congestion windows, packet sizes and server processing are not modelled. Numbers are illustrative.