HTTP/2 and HTTP/3 in System Design Interviews: When to Use Them
When interviewers ask you to design a web-scale service, they often want to see whether you understand the transport layer that carries the API calls. HTTP/2 and HTTP/3 are the two most recent versions of the protocol that browsers and services use today. Both aim to make the request-response cycle faster, but they do it in different ways.
One-Sentence Definitions
- HTTP/2: A binary version of HTTP that multiplexes many streams over a single TCP connection, using header compression and server push.
- HTTP/3: An HTTP layer that runs on top of QUIC, a UDP-based transport that provides multiplexed streams, built-in TLS, and faster loss recovery.
The Problem They Solve
In HTTP/1.1 a connection carries one request at a time, so parallel requests each need their own TCP connection or suffer from head-of-line blocking when pipelined. Imagine a content-delivery network (CDN) serving a web page that loads dozens of CSS, JS, and image files. With HTTP/1.1 the browser opens several TCP connections, each incurring a three-way handshake and TCP slow-start. If any packet is lost, all streams on that connection stall until the loss is recovered. The latency adds up, especially on high-latency links.
How They Work – Step by Step
HTTP/2
- Upgrade: The client sends an
Upgrade: h2cheader (or uses ALPN during TLS handshake) to negotiate HTTP/2. - Binary Framing: All messages are split into frames (HEADERS, DATA, SETTINGS, etc.) and sent over a single TCP socket.
- Multiplexing: Each request gets a stream identifier. Frames from different streams interleave, so the client can send dozens of requests without waiting for prior responses.
- Header Compression: HPACK compresses repeated header fields, saving bandwidth.
- Server Push: The protocol lets the server send resources (e.g., a CSS file) on a new stream before the client asks for them, but Chrome and Firefox no longer accept pushed resources, so do not build a design on it.
HTTP/3 (QUIC)
- Handshake: The client and server perform a TLS 1.3 handshake over UDP; the handshake combines transport and security negotiation, reducing round-trips.
- Connection IDs: QUIC uses connection IDs so that the transport stays intact even if the client IP changes (useful for mobile handoffs).
- Stream Multiplexing: Like HTTP/2, each request is a QUIC stream, but loss on one stream does not block others because QUIC delivers each stream’s data independently instead of through one ordered TCP byte stream.
- Built-in Congestion Control: QUIC implements its own congestion algorithm (e.g., Cubic or BBR) directly on top of UDP.
- 0-RTT Data: If the client has previously connected, it can send data immediately, cutting latency further.
Worked Example: Loading a Blog Page
Assume a user visits https://example.com/blog. The page HTML references style.css, bundle.js, and three images.
HTTP/1.1
- Browser opens up to 6 parallel TCP connections to the host (the usual per-host limit). Each performs its own TCP and TLS handshake (about 2 RTT with TLS 1.3) and its own slow-start. The handshakes run in parallel, so setup latency ≈ 2 RTT, then responses queue one at a time on each connection.
HTTP/2
- Browser negotiates HTTP/2 on the first TLS handshake. All resources share one TCP socket. The client sends HEADERS frames for the HTML, CSS, JS, and images on separate streams. The server interleaves frames from different streams, so
style.csscan arrive while the HTML is still streaming. One TCP and TLS handshake, so setup latency ≈ 2 RTT, then parallel receipt of all resources on that connection.
HTTP/3
- Browser performs a QUIC handshake (still TLS 1.3, but over UDP). QUIC folds the transport and TLS handshakes into one round trip; it still ramps up with its own congestion control, including slow-start. If the client has a previous connection, it can use 0-RTT and start sending HEADERS immediately. Loss on the image packets does not block the CSS or JS streams. Latency ≈ 1 RTT (or 0 RTT) + parallel receipt.
Where It Shows Up in Classic Design Questions
| Design Question | Typical Spot for HTTP/2/3 | Why It Matters |
|---|---|---|
| Design a CDN | Edge-to-origin fetch layer | Multiplexing reduces the number of TCP handshakes for each asset, improving cache fill time. |
| Build a Video Streaming Service | Manifest and chunk delivery API | Multiplexing (HTTP/2) or independent QUIC streams with a faster handshake (HTTP/3) help deliver the manifest and initial chunks faster, reducing start-up delay. |
| Design an API Gateway | Ingress layer that aggregates microservice calls | HTTP/2 multiplexing lets the gateway reuse a single connection to downstream services, cutting connection overhead. |
Trade-offs and the Alternative Interviewer May Ask About
| Aspect | HTTP/2 | HTTP/3 | Alternative (HTTP/1.1) |
|---|---|---|---|
| Transport | TCP (reliable, ordered) | QUIC over UDP (reliable, ordered per stream) | TCP, one request at a time per connection |
| Latency | Reduces RTTs after handshake, but still suffers from TCP loss recovery | Faster loss recovery, 0-RTT possible | Highest RTT cost per request |
| Compatibility | Widely supported in browsers and servers | Still rolling out; older clients fall back to HTTP/2 or 1.1 | Universal support |
| Complexity | Requires TLS ALPN, binary framing | Requires QUIC implementation, handling of UDP-related issues | Simple request/response model |
| Resource Usage | One TCP socket per client, less CPU for connection setup | Slightly higher CPU for QUIC encryption, but fewer connections overall | More sockets, higher handshake overhead |
Interviewers may ask you to compare HTTP/2 with HTTP/1.1, or to justify why you would keep HTTP/1.1 for a legacy service. Be ready to mention that HTTP/1.1 is still useful when you need maximum compatibility or when the client cannot handle TLS ALPN.
30-Second Spoken Version
"HTTP/2 multiplexes many request streams over a single TCP connection, eliminating HTTP-level head-of-line blocking and compressing headers. HTTP/3 builds on QUIC, moving transport to UDP, which gives per-stream loss recovery and optional 0-RTT data. Use them when a service serves many small assets—like a CDN or API gateway—because they cut handshake latency and improve parallelism. The trade-off is added complexity and the need for modern client support; otherwise HTTP/1.1 remains the safe fallback."
Common Mistakes Candidates Make
- Treating the protocol as a silver bullet: Mentioning HTTP/2/3 without linking it to the specific latency problem of the design shows a lack of depth.
- Ignoring TLS overhead: Both versions require TLS; forgetting to account for the handshake cost can lead to an unrealistic latency estimate.
- Confusing multiplexing with load balancing: Multiplexing reduces connection count, but it does not replace the need for a load balancer or sharding strategy.
- Forgetting fallback paths: In a real system you need to support clients that only speak HTTP/1.1; omitting this can be a red flag.
- Mixing up the layers: Saying QUIC is “HTTP/3” rather than “the transport layer underneath HTTP/3” shows a conceptual gap.
How to Practice This
- Pick a classic design prompt (e.g., design a CDN). Sketch the request flow on a whiteboard, then overlay where HTTP/2 multiplexing or HTTP/3 QUIC streams would sit.
- Write a short 30-second pitch that explains the benefit of the chosen protocol for that design. Record yourself and check the timing.
- Use System Design AI’s canvas to draw the full architecture, annotate the HTTP layer, and ask the AI coach to review your explanation.
Questions people ask
When should I mention HTTP/2 in a system design interview?
Bring up HTTP/2 when the design involves many small requests per client, such as a CDN serving static assets or an API gateway aggregating calls. Emphasize multiplexing and header compression as the key benefits.
What is the main advantage of HTTP/3 over HTTP/2?
HTTP/3 runs on QUIC, which provides per-stream loss recovery and optional 0-RTT data. This reduces latency on lossy networks and avoids head-of-line blocking caused by TCP.
Do I need to worry about TLS when discussing HTTP/2/3?
Yes. Both protocols are typically used over TLS. Mention the ALPN negotiation for HTTP/2 and the built-in TLS 1.3 handshake in QUIC for HTTP/3, and account for the extra round-trip in your latency calculations.
Can I use HTTP/2/3 with legacy browsers?
Most modern browsers support HTTP/2, and many now support HTTP/3, but older clients fall back to HTTP/1.1. In an interview, note that you would need a fallback path for those clients.