HTTP/2 是否提高了每个主机的连接限制? [英] Is the per-host connection limit raised with HTTP/2?

查看:30
本文介绍了HTTP/2 是否提高了每个主机的连接限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

浏览器对每个主机的并行 XHR 数量有限制(现在大约 6 个).

Browsers have a per-host limit regarding number of parallel XHR (about 6 nowadays).

此限制是否适用于多路复用 HTTP/2 连接?

推荐答案

在使用 HTTP/1.1 时,浏览器将每个域的连接数限制为 6-8 个,具体取决于浏览器的实现.这允许每个域最多 6-8 个并发请求.

Browsers impose a per-domain limit of 6-8 connections when using HTTP/1.1, depending on the browser implementation. This allows at most 6-8 concurrent requests per domain.

使用 HTTP/2,浏览器每个域只打开 1 个连接.但是,由于 HTTP/2 协议的多路复用特性,每个域的并发请求数不限于 6-8,而是几乎无限.

With HTTP/2, browsers open only 1 connection per domain. However, thanks to the multiplexing feature of the HTTP/2 protocol, the number of concurrent requests per domain is not limited to 6-8, but it is virtually unlimited.

实际上是无限的,因为浏览器和服务器可以通过 HTTP/2 配置参数称为SETTINGS_MAX_CONCURRENT_STREAMS.

It is virtually unlimited in the sense that browsers and servers may limit the number of concurrent requests via the HTTP/2 configuration parameter called SETTINGS_MAX_CONCURRENT_STREAMS.

典型限制约为 100(Firefox 的 network.http.spdy.default-concurrent 的默认值 - 请注意此处的 spdy 名称:它是HTTP/2 协议),但可能更大(或者,不太常见的是,更小),具体取决于浏览器实现和您连接的服务器.

Typical limits are around 100 (Firefox's default value for network.http.spdy.default-concurrent - note the spdy name here: it was the protocol ancestor of the HTTP/2 protocol) but could be larger (or, less commonly, smaller), depending on browser implementation and on the server you connect to.

随着 HTTP/2 的发展和更广泛的使用,预计这些限制会随着 HTTP/2 的发展和更广泛的使用而变化(就像 HTTP/1.1 发生的情况一样:浏览器从 2 个连接开始,几年后最终达到 6-8使用、经验和调优).

Expect these limits to vary over the years with the evolution and the more widespread usage of HTTP/2 (in the same way it happened with HTTP/1.1: browsers started with 2 connections, and ended up to 6-8 after years of usage, experience and tuning).

我认为浏览器处理连接数和并发请求数的方式与正常浏览和使用 XHR 的方式没有任何区别,因此上述解释也适用于 XHR.

I don't think there is any difference between how a browser treats the number of connections and concurrent requests for normal browsing and for the usage of XHR, so the explanations above holds true for XHR as well.

这篇关于HTTP/2 是否提高了每个主机的连接限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆