The Need for Speed
The web has changed. We went from simple HTML pages to complex applications with hundreds of assets (JS, CSS, Images).
HTTP/1.1 (1997)
Protocol: Text-based (ASCII). Transport: TCP.
The Problem: Head-of-Line Blocking (HOL)
HTTP/1.1 processes requests sequentially on a connection.
- Browser asks for
style.css. - Browser asks for
script.js. - If
style.csstakes 5 seconds,script.jswaits (blocked).
Workaround: Browsers open 6 TCP connections per domain. (Still limited).
HTTP/2 (2015)
Protocol: Binary. Transport: TCP.
The Solution: Multiplexing
HTTP/2 allows multiple streams over a single TCP connection.
- Requests are broken into binary frames.
- Frames are interleaved.
script.jsframes can arrive beforestyle.cssframes if they are ready first.
Other Features
- Header Compression (HPACK): Don't send
User-Agent: Chromerepeatedly. - Server Push: Server sends
style.cssbefore browser asks (Deprecated in Chrome 2022 due to complexity).
The New Problem: TCP HOL Blocking
HTTP/2 fixed Application HOL blocking but introduced Transport HOL blocking. If one packet is lost in TCP, the OS holds back all streams until that packet is retransmitted. One dropped packet slows down everything.
HTTP/3 (2022)
Protocol: Binary (QUIC). Transport: UDP (User Datagram Protocol).
The Solution: QUIC
Builds reliable transport on top of UDP in user-space.
- Independent Streams: Packet loss in Stream 1 does not affect Stream 2.
- 0-RTT Handshake: Faster connection setup (TLS 1.3 built-in).
- Connection Migration: Switch from Wi-Fi to 5G without reconnecting (Connection ID persists).
Performance Comparison
| Feature | HTTP/1.1 | HTTP/2 | HTTP/3 |
|---|---|---|---|
| Transport | TCP | TCP | UDP (QUIC) |
| Multiplexing | No (Pipelining failed) | Yes | Yes |
| HOL Blocking | App Layer | Transport Layer | None |
| Security | TLS Optional | TLS Required (Implicit) | TLS 1.3 Built-in |
| Handshake | 2-3 RTT | 2-3 RTT | 0-1 RTT |
Code Example: Go Server (Generic)
Implementing versions is often transparent to app logic.
package main
import (
"fmt"
"net/http"
"golang.org/x/net/http2"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Protocol: %s", r.Proto)
}
func main() {
server := &http.Server{Addr: ":443"}
// Enable HTTP/2 automatically if using TLS
http2.ConfigureServer(server, &http2.Server{})
http.HandleFunc("/", handler)
// Serve HTTPS (Required for H2/H3 in browsers)
server.ListenAndServeTLS("cert.pem", "key.pem")
}
Adoption Reality: Which Version Should You Serve?
The web runs all three versions simultaneously, and the split is stable enough to plan around: roughly a third of requests to major CDNs arrive over HTTP/3, most of the rest over HTTP/2, with HTTP/1.1 persisting for legacy clients, corporate proxies, and server-to-server traffic.
The practical guidance:
- At the edge: enable all three. Browsers negotiate transparently (H2 via TLS ALPN; H3 via the
Alt-Svcheader or DNS HTTPS records inviting the client to upgrade on the next connection). Users on flaky mobile networks benefit most from H3 — QUIC's independent streams and connection migration (surviving a WiFi→cellular switch without reconnecting) shine exactly there. - Behind the load balancer: it's common — and sane — to terminate H2/H3 at the edge and speak HTTP/1.1 to backends over a fast datacenter network, where its simplicity wins and its weaknesses (per-connection HOL blocking) barely matter across 0.2ms links. The big exception is gRPC, which requires end-to-end HTTP/2 for its multiplexed streaming — see GraphQL vs REST vs gRPC.
- Watch UDP throttling: some corporate networks and older middleboxes throttle or block UDP/443. Clients fall back to H2 automatically, but if your H3 error rates look odd for specific networks, this is why.
What Actually Got Faster (And What Didn't)
A protocol upgrade is not a magic performance patch — it helps specific bottlenecks:
| Bottleneck | H1 → H2 | H2 → H3 |
|---|---|---|
| Many small assets | Huge win (multiplexing kills the 6-connection limit) | minor |
| Lossy network (mobile) | can be worse than H1 | Big win (no TCP-level HOL blocking) |
| Connection setup latency | same | Win (1-RTT, 0-RTT resumption) |
| One big download | ~no change | ~no change (bandwidth-bound) |
| Header-heavy APIs | Win (HPACK compression) | similar (QPACK) |
The counterintuitive row is the second: on a lossy path, H2's single TCP connection means one lost packet stalls all multiplexed streams — measurements during H3's development showed H2 underperforming H1's six separate connections in high-loss conditions. That transport-level flaw is the single strongest justification for QUIC's existence.
Interview Tips 💡
- "Why UDP?" — TCP is too hard to change (ossified in middleboxes). UDP is just a raw socket. We implemented TCP features (reliability, congestion control) on top of UDP in user-space (QUIC).
- "What is HOL blocking?" — Explain both App-layer (H1) and Transport-layer (H2/TCP) variations.
- "0-RTT" — If client has talked to server before, it can send data in the first packet. Risk: Replay Attacks.
- "Server Push" — Mention it failed in practice because server doesn't know browser cache state.
103 Early Hintsis the modern replacement.
Related Concepts
- TCP Handshake
- Load Balancing (L7 vs L4)
About ScaleWiki
ScaleWiki is an interactive educational platform dedicated to demystifying distributed systems, software architecture, and system design. Our mission is to provide high-quality, technically accurate resources for software engineers preparing for interviews or solving complex scaling challenges in production.
Read more about our Editorial Guidelines & Authorship.
Educational Disclaimer: The architectural patterns and system designs discussed in this article are based on common industry practices, technical whitepapers, and public engineering blogs. Actual implementations in enterprise environments may vary significantly based on specific product requirements, legacy constraints, and evolving technologies.
Related Articles
TCP Handshake & Congestion
The 3-way handshake that powers the internet. SYN, SYN-ACK, ACK. Flow control vs Congestion control, and modern algorithms like BBR.
DNS Architecture
The phonebook of the internet. How Domain Name System works, the hierarchy of Route 53, and recursive vs iterative resolution strategies.
Load Balancing
Layer 4 vs Layer 7 Load Balancing. Algorithms (Round Robin, Least Connections, Consistent Hashing). Health checks and real-world implementation with Nginx.