Skip to content
web technology questions

Web Technology · 2 of 10senior~1 min

What is the difference between HTTP/1.1, HTTP/2, and HTTP/3?

#http#networking#performance

HTTP Versions

HTTP/1.1 (1997)

  • One request per TCP connection at a time.
  • Head-of-line blocking - requests queue behind slow ones.
  • Workarounds: multiple TCP connections (6 per origin), domain sharding, bundling, sprites.
text
Connection 1: GET /style.css -> wait -> GET /app.js -> wait -> ... Connection 2: GET /logo.png -> wait -> ...

HTTP/2 (2015)

  • Multiplexing - multiple requests over a single TCP connection simultaneously.
  • Header compression (HPACK) - reduces overhead of repeated headers.
  • Server push - server could proactively send resources (removed from Chrome in 2022 and practically dead; use <link rel="preload"> and 103 Early Hints instead).
  • Stream prioritization - critical resources first.
text
Single TCP connection: Stream 1: GET /style.css ----> Stream 2: GET /app.js ----> Stream 3: GET /logo.png ----> (all in parallel)
  • Still has TCP head-of-line blocking - a lost packet blocks all streams.

HTTP/3 (2022)

  • Built on QUIC (UDP-based) instead of TCP.
  • No head-of-line blocking - lost packet only blocks its own stream.
  • Faster connection setup - transport and TLS 1.3 handshake combined: 1-RTT, or 0-RTT on resumption (vs 2-3 RTT for TCP + TLS).
  • Better performance on unreliable networks (mobile).

Comparison

HTTP/1.1HTTP/2HTTP/3
ProtocolTCPTCPQUIC (UDP)
MultiplexingNoYesYes
Head-of-line blockingYesTCP levelNo
Header compressionNoHPACKQPACK
Connection setupSlowFastFastest

HTTP/2 removed the need for many HTTP/1.1 workarounds like bundling and sprites. With HTTP/2 and HTTP/3, serving many small files is often better than one large bundle.

updated

did you know it?

related questions