Series:
HTTP/3: From A To Z, Core Concepts (Part 1) — Smashing Magazine
HTTP/3: Performance Improvements (Part 2) — Smashing Magazine
HTTP/3: Practical Deployment Options (Part 3)
Relates:
Head-of-Line Blocking in QUIC and HTTP/3: The Details
HTTP/2 progressive image streaming
Optimizing TLS Record Size & Buffering Latency - igvita.com
Optimizing TLS over TCP to reduce latency
Beyond Server Push: The 103 Early Hints Status Code | Fastly | Fastly
Deprecated: HTTP/2 Push: The details
Deprecated: HTTP/2 push is tougher than I thought - JakeArchibald.com
<aside> 📘 TL;DR
Pros | Cons | |
---|---|---|
HTTP/1 | 六连接并行、批量加密 | 拥塞控制失效易丢包、HOL、文件数量多时需要排队 |
HTTP/2 | HTTP stream、文件数量多时并发性能好 | TCP HOL(应用层多路复用在传输层无效) |
HTTP/3 | QUIC stream、比 TLS 少一个 RTT | stream HOL、逐包加解密、传输层的多路复用易受丢包干扰 |
串行传输往往比多路复用好,但是多路复用能带来更多想象力。
</aside>
Robin Marx is a Web Performance and network protocol researcher at Hasselt University, Belgium. He is mainly looking into HTTP/3 and QUIC performance, and develops the qlog and qvis tools to make this easier. In a previous life he was a multiplayer game programmer and co-founder of LuGus Studios. YouTube videos of Robin are either humoristic technical talks or him hitting other people with longswords.
As you may have heard, after 4 years of work, the new HTTP/3 and QUIC protocols are finally approaching official standardization. Preview versions are now available for testing in servers and browsers alike.
HTTP/3 is promising major performance improvements compared to HTTP/2, mainly because it changes its underlying transport protocol from TCP to QUIC over UDP. In this post, we’ll be taking an in-depth look at just one of these improvements, namely the removal of the “Head-of-Line blocking” (HOL blocking) problem. This is useful because I’ve read a lot of misconceptions on what this actually means and how much it helps in practice. Solving HOL blocking was also one of the main motivations behind not just HTTP/3 and QUIC but also HTTP/2, so it gives a fantastic insight in the reasons for protocol evolution as well.
I’ll first introduce the problem and then track different forms of it throughout HTTP’s history. We will also look how it interacts with other systems like prioritization and congestion control. The goal is to help people make correct assumptions about HTTP/3’s performance improvements, which (spoiler) might not be as amazing as sometimes claimed in marketing materials.
It’s difficult to give you a single technical definition of HOL blocking, as this blogpost alone describes four different variations of it. A simple definition however would be:
When a single (slow) object prevents other/following objects from making progress
A good real-life metaphor is a grocery store with just a single check-out counter. One customer buying a lot of items can end up delaying everyone behind them, as customers are served in a First In, First Out manner. Another example is a highway with just a single lane. One car crash on this road can end up jamming the entire passage for a long time. As such, even a single issue at the “head” can “block” the entire “line”.
This concept has been one of the hardest Web performance problems to solve. To understand this, let’s start at its incarnation in our trusted workhorse: HTTP version 1.1
HTTP/1.1 is a protocol from a simpler time. A time when protocols could still be text-based and readable on the wire. This is illustrated in Figure 1 below:
Figure 1: server HTTP/1.1 response for *script.js*
In this case, the browser requested the simple script.js
file (green) over HTTP/1.1, and Figure 1 shows the server’s response to that request. We can see that the HTTP aspect itself is straightforward: it just adds some textual “headers” (red) directly in front of the plaintext file content or “payload”. Headers + payload are then passed down to the underlying TCP (orange) for actual transport to the client. For this example, let’s pretend we cannot fit the entire file into 1 TCP packet and it has to be split up into two parts.
Note: in reality, when using HTTPS, there is another Security layer in between HTTP and TCP, where the TLS protocol is typically used. However, we omit that here for clarity. I did include a bonus section at the end that details a TLS-specific HOL blocking variant and how QUIC prevents it. Feel free to read it (and the other bonus sections) after reading the main text.
Now let’s see what happens when the browser also requests style.css
in Figure 2:
Figure 2: server HTTP/1.1 response for script.js and style.css