浏览器中的最大并行 HTTP 连接数? [英] Max parallel HTTP connections in a browser?

查看:45
本文介绍了浏览器中的最大并行 HTTP 连接数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一些与 HTTP 服务器(彗星、反向 AJAX 等)的挂起连接.它工作正常,但我看到浏览器只允许同时挂起两个连接到给定域.因此,如果用户在浏览器的 Tab1 中查看我的网站,然后又尝试在 Tab2 中加载它,他们已经用完了与我网站的两个允许连接.

I am creating some suspended connections to an HTTP server (comet, reverse AJAX, etc). It works ok, but I see the browser only allows two suspended connections to a given domain simultaneously. So if a user is looking at my website in Tab1 of their browser, then also tries loading it in Tab2, they've used up the two allowed connections to my site.

我想我可以做一些通配符域的事情,在那里我让我的 HTTP 服务器解析我的网站的任何地址,例如:

I think I can do some wildcard domain thing, where I have my HTTP server resolve any address to my site like:

*.example.com/webapp  -> 192.0.2.1 (the actual ip of my server)

所以:

a.example.com/webapp
b.example.com/webapp
c.example.com/webapp

all 仍然指向 (www.example.com/webapp) 但浏览器认为它们是不同的域,所以我没有遇到 2 个连接限制.这是真的吗?

all still point to (www.example.com/webapp) but the browser considers them different domains, so I don't run into the 2 connection limit. Is this true?

即使是真的 - 是否对所有域中每个浏览器的活动连接数有任何限制?假设我使用上面的方案 - 例如,Firefox 是否在任何给定时间只允许 24 个并行连接?类似的东西:

Even if that is true - is there any limit to the number of active connections per browser, across all domains? Say I use the scheme above - does Firefox for example only allow 24 parallel connections at any given time? Something like:

1) a.example.com/webapp
2) www.download.example/hugefile.zip
3) b.example.com/webapp
4) c.example.com/webapp
...
24) x.example.com/webapp
25) // Error - all 24 possible connections currently in use!

我只是以 24 个连接/Firefox 为例.

I just picked 24 connections/Firefox as an example.

推荐答案

每个服务器/代理的默认同时持久连接的最大数量:

Max Number of default simultaneous persistent connections per server/proxy:

Firefox 2:  2
Firefox 3+: 6
Opera 9.26: 4
Opera 12:   6
Safari 3:   4
Safari 5:   6
IE 7:       2
IE 8:       6
IE 10:      8
Edge:       6
Chrome:     6

限制是每个服务器/代理,因此您的通配符方案将起作用.

The limit is per-server/proxy, so your wildcard scheme will work.

仅供参考:这与 HTTP 1.1 相关;其他协议有不同的关注点和限制(即 SPDY、TLS、HTTP 2).

FYI: this is specifically related to HTTP 1.1; other protocols have separate concerns and limitations (i.e., SPDY, TLS, HTTP 2).

这篇关于浏览器中的最大并行 HTTP 连接数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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