How Does HTTP/2 Multiplex Multiple Requests Over a Single TCP Connection?
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
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)
"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."
Common Misconception vs Reality
"HTTP/2 completely eliminates all head-of-line blocking under all network conditions."
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
HTTP/1.1 vs HTTP/2: Technical Differences & Comparison →
In-depth benchmark comparing text pipelines with binary multiplexing, stream priorities, and HPACK.
Interactive ToolHTTP Header Analyzer →
Inspect live HTTP protocol version negotiation (HTTP/1.1 vs HTTP/2 vs HTTP/3).
Developer ReferenceWhat is HTTP? Direct Protocol Definition →
Related Questions in the Q&A Knowledge Base
Yes, HTTPS encrypts the entire HTTP request—including the URL path, query parameters, request headers, cookies, and message body. Only the destination hostname (domain name) and port number are visible on the wire via the TLS Server Name Indication (SNI) extension.
Last-Modified is a timestamp-based cache validator with 1-second resolution, while ETag is an arbitrary content-based fingerprint (such as a hash) that accurately detects byte-level changes even when modifications occur multiple times in the same second or across distributed server clusters.
An HTTP method is idempotent if executing it multiple times produces the exact same server state as executing it once. PUT is idempotent because repeating a PUT replaces the target resource at a known URI, whereas repeating a POST creates additional new subordinate resources or appends duplicate records each time.
Zugehöriges technisches Ökosystem & nächste Schritte
Verwandte Fachartikel
What Is HTTP (Hypertext Transfer Protocol)?
Foundational stateless request-response protocol of the World Wide Web.
HTTP/1.1 vs HTTP/2: Multiplexing & Performance
Head-of-line blocking compared to binary framing and stream multiplexing.
Troubleshooting: HTTP 403 Forbidden Error
Diagnose server authorization denial, WAF IP blocks, and permission issues.
Praxis-Diagnoselabore
Entwickler-Spezifikationen & Referenzen
Weiterlernen
HTTP Protocol & Header Inspection Lab
Craft raw HTTP headers and observe conditional 304 responses in the interactive workbench.