Under HTTP2, how often are new TCP connections initiated?

I understand that HTTP2 aims to keep everything under a single TCP connection, and I was wondering how often TCP connections would be torn down.

For example, if I visit youtube, do some browsing, leave the site, and come back, will I be re-using the same HTTPS connection (in terms of TCP 4-tuple, NOT session), or a different one?

A lot of this is probably application-specific, and up to how the browser implements it, but is it specified anywhere in the standard?


Solution 1:

There are only few guidelines in the relevant section 9 of the specification:

  • There should not be multiple connections from the browser to the same server
  • Connections should not be closed "until it is determined that no further communication with a server is necessary", i.e. when the tab is closed and no other tabs have communication to the server
  • The server can close idle connections at any time, but servers are encouraged to keep connections open as long as possible.

For example, if I visit YouTube, do some browsing, leave the site, and come back, will I be re-using the same HTTPS connection (in terms of TCP 4-tuple, NOT session), or a different one?

In this case chances are high that a new connection will be used, at least unless another tab has some video from YouTube embedded. But since resources at the client are usually cheaper than on the server (except maybe for mobile phones) it might be that the server will be the first one to close the idle connection in order to save resources.