Networking for Interviews/HTTP: 1.1 through 3

HTTP/1.1, HTTP/2 & HTTP/3 Compared

Persistent connections and HOL blocking in HTTP/1.1, HTTP/2 multiplexing and HPACK on one TCP connection, HTTP/3 and QUIC over UDP — when each still appears in production.

3/5Overview: 30m

HTTP/1.1 — what senior engineers still need

  • Request/response over TCP: methods, status codes, headers, body.
  • Persistent connections (keep-alive) — reuse TCP for multiple requests; avoids handshake tax.
  • Pipelining — largely failed in practice; browsers opened parallel connections instead (typically 6 per host) — domain sharding was a hack to raise parallelism.
  • Head-of-line blocking — one slow response blocks the next on the same connection.

Know idempotency: GET/PUT/DELETE vs POST; matters for retries and 0-RTT.

HTTP/2 — multiplexing on one TCP connection

  • Binary framing — streams multiplexed on a single connection.
  • HPACK header compression.
  • Server push — mostly fell out of favor; know it existed.

The catch: TCP HOL blocking still applies — one lost packet stalls all streams on that connection. HTTP/2 fixed HTTP/1 connection limits, not TCP loss behavior.

HTTP/3 & QUIC

  • Runs over UDP with QUIC providing reliability, encryption (TLS 1.3 integrated), and per-stream multiplexing — loss on one stream doesn't block others.
  • Connection migration — survives IP address changes (mobile).
  • Adoption growing at CDNs and browsers; many origins still HTTP/2 or HTTP/1.1 behind TLS terminators.

Comparison table (memorize this)

HTTP/1.1HTTP/2HTTP/3
TransportTCPTCPQUIC (UDP)
MultiplexingParallel connectionsStreams on one TCPStreams, no TCP HOL
TLSOptional → facto requiredTLS requiredTLS 1.3 built in
Interview focusKeep-alive, caching headersMultiplexing, HPACK ideaWhy UDP, per-stream isolation

Caching headers (often paired with HTTP questions)

Cache-Control (max-age, no-store), ETag / If-None-Match for validation, Vary for cache key dimensions. Senior signal: distinguish browser cache vs CDN edge cache vs application cache.

Further Reading

Hands-On Tasks (Optional)

Low-setup exercises you can run locally or on a free-tier cloud account. No autograding — the goal is to build intuition, not pass a test.

  • Check which HTTP version a site uses

    Run `curl -sI --http2 https://example.com | head` and `curl -sI --http3 https://cloudflare.com 2>/dev/null | head` (if your curl supports HTTP/3). Note protocol line and Alt-Svc header.

    10m