Introduction
In today's hyper-connected world, the speed and efficiency of Internet connections are crucial to delivering an optimal user experience. One way to improve this efficiency is by using HTTPS DNS records to announce HTTP/3 support. This is where "savearoundtrip" comes into play. By publishing an HTTPS DNS record, sites can avoid an unnecessary round trip, reducing latency and enhancing overall performance.
Why Use an HTTPS DNS Record?
Browsers can discover a site's HTTP/3 support in two ways: either by first connecting over HTTP/1 or HTTP/2 and reading the Alt-Svc HTTP header or immediately from an HTTPS DNS record lookup. The DNS record allows the browser to use HTTP/3 on the first connection. By saving a round trip, crucial time is saved, especially on long-distance connections.
The Impact of Round Trips
A round trip is one message to the server and back, bounded by the speed of light: roughly 5 to 20 ms within a city, 40 to 80 ms across a country, and 150 ms or more across an ocean or a mobile network. According to Nielsen Norman Group, an interaction feels instantaneous under about 100 ms; past that, it feels like waiting.
The Problem with Alt-Svc
The Alt-Svc header is an HTTP response. To read it, the client must finish a request, which means it has already opened a TCP connection, done a TLS handshake, and spoken HTTP/1.1 or HTTP/2. Only then does it learn that it can also speak HTTP/3, which occurs on the next connection.
Sequence Diagram
Let's take an example:
``sequence participant C as Client participant D as DNS participant S as Server Note over C,S: First connection C->>D: look up A / AAAA D-->>C: IP address C->>S: TCP SYN S-->>C: SYN-ACK C->>S: TLS ClientHello S-->>C: TLS ServerHello, Finished C->>S: HTTP/2 request S-->>C: response + Alt-Svc: h3 Note over C,S: only now does the client learn you speak HTTP/3 Note over C,S: Second connection C->>S: QUIC + HTTP/3 handshake S-->>C: connected (HTTP/3) ``
Benefits of HTTPS DNS
An HTTPS record (RFC 9460) carries the same "I speak HTTP/3" signal, but in the DNS. The client can immediately establish an HTTP/3 connection without waiting for a second request.
Use Cases and Figures
Consider the case of Firefox Nightly, where many connections only reach HTTP/3 on a later connection. By publishing an HTTPS record, each connection could save a round trip on the first interaction.
As of 2023, about 40% of major sites already use HTTP/3, but only a fraction of them use HTTPS DNS records to optimize protocol discovery.
Conclusion
Using HTTPS DNS records is an effective strategy to reduce latency and improve user experience. By integrating this method, you can offer faster and more reliable connections to your users.
Let's discuss your project in 15 minutes.