大网数据广告活动
服务器运维问答

Under HTTP2, how often are new TCP connections initiated?

· 52CE 我爱测

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, wi…

问题原文

原帖链接 · fruglemonkey · CC BY-SA 3.0

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?

已采纳解答

原帖链接 · Steffen Ullrich · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-31)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。