EasyNetwork Optimization📖 Theory Question

How does HTTP/2 multiplexing improve performance over HTTP/1.1?

💡

Hint

HTTP/2 allows multiple requests on one TCP connection simultaneously — eliminates head-of-line blocking and domain sharding hacks

Full Answer

HTTP/1.1 limitation: One request at a time per TCP connection. Browsers open 6–8 parallel connections per domain to work around this, but each connection has overhead (TCP handshake, slow start).

HTTP/2 multiplexing:

  • A single TCP connection carries multiple streams simultaneously — no waiting for one response before sending the next.
  • Requests are broken into binary frames that are interleaved and reassembled by the receiving end.
  • Eliminates head-of-line blocking at the HTTP layer (TCP-level HOL blocking still exists; fixed by HTTP/3 QUIC).

Other HTTP/2 features:

  • Header compression (HPACK) — compresses repeated headers; saves bandwidth on API-heavy SPAs.
  • Server push — server sends resources before the client asks (largely abandoned in practice due to poor cache interaction).
  • Request prioritization — critical resources can be prioritized over background requests.

HTTP/2 makes these obsolete: domain sharding, CSS sprites, JS concatenation for HTTP performance (code splitting is now safe).

More Network Optimization Questions

EasyWhat is the difference between preload, prefetch, and preconnect?→EasyWhat is the difference between defer and async on script tags?→EasyWhat is image optimization and what techniques does Next.js Image component apply?→MediumWhat is the critical rendering path and how do you optimize it?→

Practice this in a timed sprint →

5 free questions, no signup required

⚡ Start Sprint