每个主机限制的 HTTP 同时连接数...是每个选项卡、浏览器实例还是全局?

标签 http websocket browser two-connection-limit

根据 HTTP 规范 (w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4),HTTP 客户端应限制其连接:

Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy.

不同的供应商以不同的方式实现此限制:http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/

但是。此限制适用于每个选项卡、每个浏览器实例还是全局适用于所有浏览器实例?弹出窗口(对话框)是选项卡的一部分还是独立选项卡?

同样适用于 websockets,每个来源的连接限制适用于每个选项卡、浏览器实例还是全局?

最佳答案

浏览器

对于不同的浏览器、浏览器版本或互联网连接速度,实现细节必然会有所不同(IE8 在拨号时使用 2 个连接,否则最多使用 6 个连接)。

此外,这些限制通常是用户可配置的(即 Mozilla 中的 network.http.max-connections-per-server),不应根据浏览器版本假定特定值。不过,脚本可能可以访问实际值,例如 IE 中的 window.maxConnectionsPerServer。

But. does this limitation applies per tab, per browser instance or globally for all the instances of the browser?

我找到的唯一相关信息是关于 IE ( http://social.msdn.microsoft.com/Forums/ie/en-US/a46bb0ba-419d-43ec-ad1b-f9596d508ca3/simultaneous-http-connection-limit ) 的:

The connection limit is per process, the browser will make the determination about process creation as a web site owner you can't really change that. The process may be shared between multiple tabs/windows or it may not, it depends on many factors outside your control

有关浏览器的更多当前数据可以在 www.browserscope.org/?category=network 找到

RFC

有一个更新的草案废弃了 RFC2616(如果获得批准)。 引用相关部分(来自 https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-p1-messaging-21#section-6.2.3 ):

6.2.3. Concurrency

Clients SHOULD limit the number of simultaneous connections that they maintain to a given server.

Previous revisions of HTTP gave a specific number of connections as a ceiling, but this was found to be impractical for many applications. As a result, this specification does not mandate a particular maximum number of connections, but instead encourages clients to be conservative when opening multiple connections.

Multiple connections are typically used to avoid the "head-of-line blocking" problem, wherein a request that takes significant server- side processing and/or has a large payload blocks subsequent requests on the same connection. However, each connection consumes server resources. Furthermore, using multiple connections can cause undesirable side effects in congested networks.

Note that servers might reject traffic that they deem abusive, including an excessive number of connections from a client.

关于每个主机限制的 HTTP 同时连接数...是每个选项卡、浏览器实例还是全局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22866552/

相关文章:

java - 在 Eclipse 插件中,如何使用系统浏览器启动 web url?

java - 我怎样才能在 java 中克服这个 HTTP GET 404 错误?

c# - 如何在 C# 中将 HTTP Last-Modified header 从 UTC 解析为 DateTime

websocket - 安全 Websocket 与不安全 Websocket 的成本

javascript - Node.js 和 web-socket-js 简单客户端服务器未打开

html - html5中如何控制列中的内容

api - cURL - 在给定范围 'start' - 'stop' 中发现无效字符

http - Azure 逻辑应用程序 - Twilio 连接器

python-3.x - Websocket(Python 3.5 中的 ws4py)在 Docker 容器中不起作用

javascript - DuckDuckGo 如何根据我是否访问过页面显示图标?