Multiplexing in HTTP/2

Overview

Let's consider a Web page test.html located at https://example.com/test.html.

The page uses a CSS sheet style.css and references three images a.jpg, b.jpg and c.jpg.

HTTP/1.1 behavior for multiple requests

If a HTTP/1.1 browser visits https://example.com/test.html, it will:

  • Open a TCP/IP connection #1 to example.com
  • Negociate an SSL/TLS session
  • Send a request for virtual path /test.html
  • Receive the reply and parse the page
  • Reuse the same connection #1 to send a new request for /style.css
  • Receive the reply
  • Open a TCP/IP connection #2 to example.com
  • Negociate an SSL/TLS session
  • Use the connection #2 to request /a.jpg
  • Reuse the connection #2 to request /b.jpg
  • Reuse the first connection #1 to request /c.jpg
  • Close both connections #1 and #2

HTTP/2 behavior for multiple requests

If a HTTP/2 browser visits https://example.com/test.html, it will:

  • Open a TCP/IP connection to example.com
  • Negociate an SSL/TLS session
  • Send a request for virtual path /test.html
  • Receive the reply and parse the page
  • Send a request for /style.css
  • Send a request for /a.jpg
  • Send a request for /b.jpg
  • Send a request for /c.jpg
  • Receive simultaneously the replies for all requested files
  • Close the connection

Conclusion

In this small example, HTTP/2 has used a single TCP/IP connection with a single SSL/TLS negociation while HTTP/1.1 required two of each. The total time to load the page with its dependencies is also shorter.

See also