HTTP/3 and QUIC simulator
HTTP/3 keeps HTTP's requests and responses but replaces TCP with QUIC, a transport built on UDP with encryption, streams and loss recovery of its own. Compare it with HTTP/2 packet by packet: how long the handshake takes, what a lost packet holds up, and what happens when the network changes mid-download.
requested, waiting for the first bytearriving
| HTTP/2 | HTTP/3 | |
|---|---|---|
| Connections | 1 | 1 |
| Setup before request | 200 ms | 100 ms |
| Half the objects done | 2.53 s | 2.42 s |
| All done | 4.75 s | 4.65 s |
| Packets lost | 10 | 10 |
| Objects held up by another's loss | 10 | 0 |
- 100 msconnection ready, after 1 round trip.
- 356 msa lost packet of object 1 is detected and resent; congestion window cut to 20 packets.
- 559 msa lost packet of object 4 is detected and resent; congestion window cut to 16 packets.
- 1.97 sa lost packet of object 17 is detected and resent; congestion window cut to 20 packets.
- 2.38 sa lost packet of object 21 is detected and resent; congestion window cut to 17 packets.
- 2.98 sa lost packet of object 27 is detected and resent; congestion window cut to 16 packets.
- 3.69 sa lost packet of object 33 is detected and resent; congestion window cut to 16 packets.
- 4.10 sa lost packet of object 37 is detected and resent; congestion window cut to 14 packets.
- 4.40 sa lost packet of object 38 is detected and resent; congestion window cut to 12 packets.
- 4.52 sa lost packet of object 40 is detected and resent; congestion window cut to 9 packets.
How to use the simulator
Both protocols load the same objects through the same simulated link, with the same congestion control and the same loss rate, so the differences come from TCP versus QUIC alone.
- Load 20 API responses with no loss and compare when the first one arrives: QUIC's handshake is one round trip shorter. Turn on 0-RTT resumption and it is shorter again.
- Set loss to 1% on the web page. In the HTTP/2 waterfall, red rows had arrived but waited behind another object's lost packet; HTTP/3 has none. Compare how much that moves the finish times.
- Load the 4 large files and switch from Wi-Fi to mobile at 0.6 s. HTTP/2 must open a new connection and start the unfinished files again; HTTP/3 pauses one round trip and carries on.
What are HTTP/3 and QUIC?
QUIC is a general-purpose transport protocol that provides what TCP and TLS provide together, reliable ordered delivery, congestion control and encryption, plus several independent streams on one connection. It runs in user space on top of UDP. HTTP/3 is the mapping of HTTP onto QUIC: each request and response uses its own QUIC stream, and headers are compressed with QPACK, a variant of HPACK that tolerates streams arriving out of order.
The changes target three weaknesses of TCP: the handshake cost of TCP followed by TLS, head-of-line blocking between unrelated streams, and connections that break when an address changes.
The handshake
Over TCP, a client first exchanges SYN and SYN-ACK (one round trip), then the TLS 1.3 handshake (a second round trip), and only then sends its request; the response takes a third. QUIC carries the TLS 1.3 handshake in its first packets, so the request can go after one round trip. With 0-RTT resumption, a client that has a ticket from an earlier session sends the request with its first packet. Time until a small response has fully arrived, with no loss:
| Round trip | HTTP/2 (TCP + TLS 1.3) | HTTP/3 | HTTP/3 with 0-RTT |
|---|---|---|---|
| 50 ms | 154 ms | 104 ms | 54 ms |
| 100 ms | 304 ms | 204 ms | 104 ms |
| 200 ms | 604 ms | 404 ms | 204 ms |
TCP and TLS can also shave round trips, with TCP Fast Open and TLS 1.3 early data, but TCP Fast Open is often blocked or disabled because of middleboxes that drop unfamiliar TCP options. 0-RTT data can be replayed by an attacker, so it is only safe for requests that can be repeated without harm; servers can refuse early data with 425 Too Early. QUIC's first packet from the client is padded to at least 1,200 bytes, and until the client's address is confirmed a server may send no more than three times what it received, so QUIC cannot be used to amplify denial-of-service attacks.
Streams without head-of-line blocking
TCP delivers one ordered byte stream, so HTTP/2 streams sharing a connection all wait when any packet is lost. QUIC frames carry a stream ID and offset, and each stream is reassembled on its own; a lost packet delays only the streams whose data it carried. The web page over a 100 ms, 20 Mbit/s link, responses sent one at a time in order, averaged over 5 loss patterns:
| Loss | A quarter done, HTTP/2 | HTTP/3 | All done, HTTP/2 | HTTP/3 | HTTP/2 objects held up |
|---|---|---|---|---|---|
| 0.5% | 907 ms | 790 ms | 2.07 s | 1.97 s | 14 of 40 |
| 1% | 948 ms | 819 ms | 2.51 s | 2.41 s | 19 of 40 |
| 2% | 1.34 s | 1.24 s | 5.84 s | 5.74 s | 13 of 40 |
HTTP/3's lead is one round trip from the handshake plus a little from head-of-line blocking. Most of the slowdown under loss comes from congestion control, which shrinks the sending rate of the whole connection on every loss, and both protocols do that. The benefit is larger when the loss rate is low and the stalls are what users notice, such as a stylesheet held back by a lost image packet, and in Google's production measurements QUIC's improvement in search latency grew as the baseline latency grew, so the slowest connections gained the most.
Connection migration
A TCP connection is identified by its two IP addresses and ports. When a phone leaves Wi-Fi for mobile data its address changes, the connection is dead, and the client must open a new one and ask again for anything unfinished. QUIC packets carry connection IDs instead, so the connection can move: the client starts sending from the new address, the server checks it can be reached there (a PATH_CHALLENGE answered by a PATH_RESPONSE) and the transfer continues. Downloading four 600 KB files at 20 Mbit/s with a switch of network at 0.6 s:
| Round trip | HTTP/2, no switch | with switch | HTTP/3, no switch | with switch |
|---|---|---|---|---|
| 50 ms | 1.24 s | 1.84 s | 1.19 s | 1.29 s |
| 100 ms | 1.62 s | 2.22 s | 1.52 s | 1.66 s |
The model has HTTP/2 restart unfinished files from the beginning; a client could resume them with range requests, at the cost of a new connection all the same. New connection IDs are issued in advance so the new path cannot be linked to the old one by an observer.
Why UDP, and what it costs
A new transport directly on IP would be dropped by firewalls and NATs that only understand TCP and UDP, and TCP itself lives in operating-system kernels and middleboxes that change slowly. QUIC therefore runs over UDP and is implemented in libraries that ship with applications, and almost all of its headers are encrypted so that the network cannot come to depend on them.
The price is CPU: user-space packet processing, per-packet encryption and the lack of the offloads TCP has accumulated made QUIC expensive at first: Google measured its server CPU use at about 3.5 times that of TLS over TCP, brought down to about twice with optimization, and techniques such as UDP segmentation offload have narrowed the gap since. Some networks block or throttle UDP, so browsers race or fall back to TCP. Clients usually learn about HTTP/3 from an Alt-Svc response header or an HTTPS DNS record.
How the simulation works
It is the same packet-level model as the HTTP/2 simulator: 1,200-byte packets through a bottleneck with a fixed rate and round trip, a seeded random loss rate, a congestion window that starts at 10 packets and is cut to 0.7 on loss, and RFC 9002's packet and time thresholds for detecting loss, applied identically to TCP and QUIC. TCP and TLS 1.3 take two round trips before the request, QUIC one, or none with 0-RTT. On a network change the TCP connection is replaced (two more round trips) and unfinished responses start again; the QUIC connection pauses one round trip for path validation and resends what was in flight. Not modeled: CPU cost, pacing, UDP blocking, QPACK and TLS record sizes.
History
Jim Roskind designed QUIC at Google in 2012; it was added to Chrome in June 2013 and served from Google's servers as an experiment from then on. In 2017 Adam Langley and colleagues reported that it carried an estimated 7% of Internet traffic, and that it cut Google Search latency by 8.0% on desktop and 3.6% on mobile and YouTube rebuffering by 18.0% and 15.3%. The IETF formed a QUIC working group in 2016 and reworked the design substantially, notably replacing Google's own cryptographic handshake with TLS 1.3. QUIC was published as RFC 9000 to 9002 in May 2021, and HTTP/3 as RFC 9114, with QPACK as RFC 9204, in June 2022.
HTTP/3 and QUIC questions and answers
What is the difference between HTTP/2 and HTTP/3?
The HTTP semantics are the same; the transport differs. HTTP/2 runs over TCP with TLS on top, HTTP/3 over QUIC, which runs over UDP and builds in TLS 1.3, streams, loss recovery and congestion control. That lets HTTP/3 set up a connection in one round trip instead of two, avoid head-of-line blocking between streams, and keep a connection when the client changes network.
Is HTTP/3 faster than HTTP/2?
Usually a little, sometimes a lot. The handshake saves one round trip on every new connection (304 ms against 204 ms to receive a small response at 100 ms round trip here, 104 ms with 0-RTT). Under random loss both protocols are limited by the same congestion control, so the gain from avoiding head-of-line blocking is modest: at 1% loss, a quarter of the page arrived after 948 ms over HTTP/2 and 819 ms over HTTP/3. Google measured 8% lower search latency on desktop and 3.6% on mobile when it moved to QUIC.
What is 0-RTT in QUIC?
When a client has talked to a server before, it can reuse keys from that session and send its request in the very first packet, before the handshake completes. The data is not protected against replay: an attacker could resend it. Servers therefore accept only safe, idempotent requests as early data and can answer 425 Too Early to make the client retry after the handshake.
Why does QUIC use UDP?
Because a new protocol directly on IP would not get through the firewalls, NATs and middleboxes of the Internet, and changing TCP itself takes years of operating-system updates. UDP passes almost everywhere and leaves QUIC free to implement reliability, ordering and congestion control in user space, encrypted so that middleboxes cannot ossify it.
What is QUIC connection migration?
A QUIC connection is identified by connection IDs rather than by IP addresses and ports, so when a phone moves from Wi-Fi to mobile data it can continue on the new path after a quick path validation. A TCP connection is bound to its address pair and has to be replaced. Here, switching networks during a 2.4 MB download at 100 ms round trip cost HTTP/2 600 ms and HTTP/3 146 ms.
How does a browser know a site supports HTTP/3?
The first visit usually goes over HTTP/2 or HTTP/1.1, and the server advertises HTTP/3 with an Alt-Svc header such as h3=":443"; the browser then tries QUIC for later connections. A site can also publish an HTTPS DNS record listing h3, so the browser can use it from the start. If UDP is blocked, browsers fall back to TCP.
Further reading
- RFC 9000, 2021QUIC: A UDP-Based Multiplexed and Secure TransportStreams, connection IDs, migration, path validation and the amplification limit.
- RFC 9114, 2022HTTP/3HTTP's mapping onto QUIC streams.
- RFC 9002, 2021QUIC Loss Detection and Congestion ControlThe thresholds and probes the simulation uses.
- RFC 9204, 2022QPACK: Field Compression for HTTP/3Header compression without cross-stream blocking.
- Langley and others, SIGCOMM, 2017The QUIC Transport Protocol: Design and Internet-Scale DeploymentGoogle's design and measurements from production.