skip to content

Over one HTTP/2 connection on a lossy roaming link, what stalls a travel-booking mobile app's hotel screen, and what does HTTP/3 change?

level: seniorimportance: nice to knowfreq 25%

answer

  1. one ordered byte stream underneath
  2. one lost packet stalls every stream
  3. QUIC streams delivered independently
  4. connection IDs outlive a network switch
  5. keep a TCP fallback ready

basics

~20 s

On HTTP/2 every request shares one TCP connection, so one lost packet stalls all streams until it is retransmitted. HTTP/3 over QUIC blocks only streams whose data was lost, and lets the client migrate the connection when the network changes.

solid answer

~50 s

HTTP/2 gives each request its own stream, but all streams ride one TCP byte stream, and TCP delivers bytes in order, so when one packet is lost the rooms, reviews and photo responses all wait for its retransmission. The HTTP/2 specification says plainly that it does not address TCP head-of-line blocking, and on a lossy radio one shared connection can suffer for it. HTTP/3 maps each request to a QUIC stream, and QUIC delivers streams independently, so a loss stalls only the streams whose data was in the lost packet. QUIC also identifies a connection by connection IDs, so a phone moving from hotel Wi-Fi to cellular can migrate the connection instead of reconnecting, unless the server disabled active migration. The app still needs a TCP fallback, because some networks block UDP and QUIC then cannot connect.

code

http · 7 lines
http
GET /hotels/h_48213/rooms HTTP/2
host: api.example.com
priority: u=1

HTTP/2 200
content-type: application/json
alt-svc: h3=":443"

go deeper

for a junior

Recall that HTTP/2 runs many requests over one TCP connection and HTTP/3 runs them over QUIC on UDP, and that a lost packet affects them differently.

for a middle

Explain the stall step by step: in-order TCP delivery holds back every stream behind one gap. Then explain what independent QUIC streams change, including the packet-level caveat.

for a senior

Design for the real network: TCP fallback when UDP is blocked, migration that a server can refuse, what to replay after a broken connection, and how you would measure the gain on slow links.

for a principal

Weigh adopting HTTP/3 across the app's backends: operational support for UDP and migration at the edge, fallback rates as a health signal, and where the gains justify the work.

## The scenario The hotel detail screen fires about a dozen requests in quick succession: the hotel record, room availability, a review summary and several photo thumbnails. The app opens one HTTP/2 connection to the API origin and sends them all as concurrent **streams**. The traveller is roaming, on a link that loses a few percent of its packets and sometimes hands over from hotel Wi-Fi to cellular. ## Why one lost packet stalls everything on HTTP/2 HTTP/2 multiplexes requests by giving each its own stream and interleaving their frames on one connection. That connection is TCP, and TCP presents one ordered byte stream to the receiver: 1. The server interleaves frames from the rooms, reviews and photo streams into TCP segments. 2. One segment, carrying part of a photo, is lost on the radio. 3. TCP holds back every byte after the gap until the lost segment is retransmitted, because it must deliver bytes in order. 4. The rooms and reviews frames that arrived after the gap sit in the phone's buffer, complete but undeliverable to the app. 5. Only after the retransmission arrives, at least one more round trip later, do all streams move again. This is **TCP head-of-line blocking**. The HTTP/2 specification states that it is not addressed by the protocol. HTTP/1.1 clients open several connections, so a loss on one stalls only that connection's response, which is why one shared HTTP/2 connection can do worse on a lossy link than its design suggests. ## What HTTP/3 over QUIC changes HTTP/3 maps each request-response pair to its own **QUIC stream**, and QUIC runs over UDP with its own loss recovery: - **Independent delivery.** When a packet is lost, only the streams with data in that packet wait for the retransmission; the others keep delivering. The caveat matters: a packet that carries frames from several streams blocks all of them when lost, and bytes within one stream are still delivered in order. - **Connection migration.** A QUIC connection is identified by **connection IDs** rather than by the address pair, so it can survive a change of the client's address, such as a move from Wi-Fi to cellular. Only clients migrate, not before the handshake is confirmed, and a server can forbid active migration with a transport parameter. - **Header compression with less coupling.** HTTP/3's header compression lets the encoder control how much head-of-line blocking compression itself can cause. ## Comparing the three on a lossy radio | Concern | HTTP/1.1, several connections | HTTP/2, one TCP connection | HTTP/3, one QUIC connection | |---|---|---|---| | Concurrency | responses one at a time, in order, per connection | many streams on one connection | many streams on one connection | | One lost packet | stalls one connection's response | stalls every stream | stalls only streams in that packet | | Wi-Fi to cellular switch | every connection breaks | the connection breaks | can migrate, if the server permits | | Network that blocks UDP | unaffected | unaffected | cannot connect; fall back to TCP | ## What the app's design controls - **Enable HTTP/3 with a fallback.** The HTTP/3 specification says clients should attempt TCP-based HTTP when a QUIC connection fails, for example because UDP is blocked. Discovery usually comes from an `Alt-Svc` response header on a TCP connection. - **Keep one warm connection per origin**, so screens do not pay new handshakes on every visit. - **Signal priority where it helps.** A request can carry an urgency from 0 to 7, default 3, with lower numbers more urgent; the server may use it to order responses, but it is a hint, not a guarantee. - **Replay only what is safe.** After a broken connection, safe and idempotent requests can be resent; a booking write needs the request pipeline's protection before any automatic resend. - **Measure by network type.** The gains sit in the lossy, high-latency tail, so compare slow percentiles on cellular, not medians on Wi-Fi. ## What to say in the interview - Name TCP head-of-line blocking as the reason multiplexing disappoints on a lossy radio. - Credit QUIC with independent streams and migration, and state both caveats. - Keep the TCP fallback in the design.

  • Does HTTP/3 remove head-of-line blocking from a mobile app's requests completely?
    No. A QUIC packet can carry data from several streams, and losing it blocks all of them; bytes within one stream still arrive in order; and header compression keeps some coupling the encoder must limit. HTTP/3 removes the connection-wide stall TCP imposes, not every wait.
  • What happens to a mobile app's in-flight HTTP/2 requests when the phone switches from Wi-Fi to cellular?
    The TCP connection is tied to the old address, so it breaks. The app opens a new connection, paying new handshakes, and must decide what to resend: safe and idempotent requests can be replayed, a booking write only with the pipeline's idempotency protection. With QUIC migration the same connection can continue on the new path, if the server allows it.
  • How would you tell whether enabling HTTP/3 actually helped a mobile app's users?
    Roll it out behind a flag and compare by network type: screen load time at slow percentiles, request failure rates, how often QUIC falls back to TCP, and failures around network switches. Expect gains on lossy, high-latency cellular links and little change on good Wi-Fi.

HTTP/2 over TCP is one conveyor belt carrying parcels for several customers in strict order: if one parcel falls off, the belt stops until it is replaced and every customer waits. QUIC gives each customer a separate belt, so only the customers with items in the fallen parcel wait.

  • HTTP/2 multiplexing removes head-of-line blocking entirely.
  • HTTP/3 works on every network, so the app needs no TCP fallback.
  • Independent HTTP/2 streams keep the connection alive when the phone changes networks.
  • QUIC connection migration is guaranteed whenever the client changes networks.
  • Setting a request's urgency guarantees that the server sends it first.