#79: QUIC: what makes HTTP/3 faster
QUIC can be thought of as the third fundamental protocol of the Internet. Next to UDP and TCP/IP. Let’s talk a little bit about these two. They both build upon IP, Internet Protocol. IP supports exchanging packets of data between two machines having… IP addresses. UDP adds ports. Port is a logical concept. It’s simply a number within one machine that identifies a certain process. Thanks to ports, many different processes on the same machine can exchange data.
TCP/IP is much, much more complex compared to UDP. First of all it introduces the concept of connections. There’s nothing physical about connection. It just means that two machines agree to talk to each other prior to exchanging any data. However, connections have two more benefits: order guarantee and flow control.
Packets sent via UDP may arrive in a different order or get lost. We sort of accept that. TCP/IP, on the other hand, delivers packets in the same order they were sent. Moreover, it keeps analyzing the bandwidth and packet loss. This is called flow control and it prevents the consumer from being too occupied.
Going back to QUIC. It’s the third network protocol that behaves much like TCP/IP. With connections, flow control, and more. However, and this is surprising, it’s not built on top of IP. Introducing the third fundamental protocol now would be impossible. There are too many routers, switches, firewalls, etc. We’d have to update the firmware of all of them.
Instead, the new QUIC protocol is built on top of UDP. But it essentially reimplements all features of TCP/IP. Plus much more. There are a few advantages of the new protocol:
Firstly, QUIC is encrypted by default. It’s part of the protocol, rather than another layer. Most of the websites these days are over TLS, so it’s a no-brainer. Moreover, baking encryption directly into the protocol makes the handshake faster.
Secondly, QUIC supports multiple independent streams within one connection. You can think of streams as sub-connections. TCP/IP has only one stream of data. If a packet is lost, the whole stream waits. Even if subsequent packets already arrived. This is called head-of-line blocking. HTTP/2 tries to build multiple streams on top of TCP/IP. QUIC has this feature natively. In simple terms, it means that lost packets only affect a single stream.
Last but not least, QUIC supports connection migration. This clever idea allows seamless switching of networks on the client-side. For example when you leave home and switch from WiFi to cellular. Or when switching to VPN. With TCP/IP these actions change your IP and you disconnect. QUIC can transparently continue transferring data with no delays or reconnects.
This new protocol has a lot more advantages. No wonder it was used as a prerequisite to run HTTP/3.
That’s it, thanks for listening, bye!