100% Client-Side Computation • Zero Server Logs • Instant Execution
Curious TechieDev Toolbox
HTTP & Web ArchitectureIntermediateVerified Answer

How Does HTTP/2 Multiplex Multiple Requests Over a Single TCP Connection?

Direct Answer (AEO Summary)

HTTP/2 multiplexes requests by splitting HTTP messages into independent binary frames tagged with a unique Stream ID. These frames are interleaved concurrently over a single shared TCP socket, eliminating the head-of-line blocking problem of HTTP/1.1.

Detailed Technical Explanation

In HTTP/1.1, connections are strictly serial: a browser must wait for a server to finish sending the response to request A before it can send request B on the same TCP socket (causing head-of-line blocking). To load assets quickly, browsers historically opened up to 6 parallel TCP connections per domain. HTTP/2 replaces textual CRLF formatting with a binary framing layer. Every request and response is assigned an integer Stream ID. Frames from dozens of different assets (CSS, JS, images) can be interleaved in any order over a single persistent TCP connection. The receiving end reassembles the frames by Stream ID as they arrive.

Technical Example & Code

Interleaved HTTP/2 Binary Frames Over One Socket

Multiple resources stream concurrently across one TCP connection without waiting.

[Single TCP Connection - Port 443]
--> Frame (Stream 1: HEADERS) GET /index.html
--> Frame (Stream 3: HEADERS) GET /app.css
--> Frame (Stream 5: HEADERS) GET /logo.png
<-- Frame (Stream 1: DATA)    <html><head>...
<-- Frame (Stream 3: DATA)    body { margin: 0; ... }
<-- Frame (Stream 5: DATA)    PNG raw bytes...
<-- Frame (Stream 1: DATA)    ...</html> [STREAM 1 FINISHED]

// All three assets transferred in parallel over ONE TCP connection!

Why This Is the Case (Underlying Architectural Rationale)

Deterministic Technical Causality (GEO)

"TCP connections are expensive: each requires a 3-way handshake, TLS cryptographic negotiation, and slow-start congestion window ramp-up. By multiplexing all streams over a single TCP connection, HTTP/2 maximizes network utilization, saves server memory, and eliminates the need for legacy optimization hacks like domain sharding and image sprites."

Official Standards:RFC 9113 (HTTP/2 Specification § 5: Streams and Multiplexing)

Common Misconception vs Reality

✕ Common Myth

"HTTP/2 completely eliminates all head-of-line blocking under all network conditions."

✓ Technical Reality

HTTP/2 eliminates HTTP-layer head-of-line blocking, but TCP-layer head-of-line blocking remains: if a single TCP packet is dropped on a lossy cellular network, the entire TCP connection stalls while retransmitting. HTTP/3 solves this by migrating to UDP-based QUIC.

Related Curious-Techie Resources

Related Questions in the Q&A Knowledge Base