浏览器中最大并行http连接数? [英] Max parallel http connections in a browser?
问题描述
我正在创建一些挂起的连接到http服务器(comet,reverse ajax等)。它工作正常,但我发现浏览器只允许同时连接到给定域的两个暂停连接。因此,如果用户在浏览器的Tab1中查看我的Web应用程序,那么也会尝试在Tab2中加载它们,它们已将用过的两个连接用完到我的网站。
我想我可以做一些通配域的事情,我有我的http服务器解决我的网站的任何地址,如:
* .mysite.com / webapp - > 123.456.789.1(我的服务器的实际ip)
so:
a.mysite.com/webapp
b.mysite.com/webapp
c.mysite.com/webapp
仍然指向(www.mysite.com/webapp),但浏览器认为它们是不同的域,所以我不遇到2个连接限制。这是真的吗?
即使为,每个浏览器的活动连接数是否有限制?假设我使用上面的方案 - 例如firefox在任何给定时间只允许24个并行连接吗?例如:
1)a.mysite.com/webapp
2)www.download.com/hugefile。 zip
3)b.mysite.com/webapp
4)c.mysite.com/webapp
...
24)x.mysite.com/webapp
25)//错误 - 当前正在使用的所有24个可能的连接!
我刚选了24个连接/ firefox作为例子。
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
Chrome:6
限制是每个服务器/代理,所以您的通配符方案将起作用。
仅供参考:这与HTTP 1.1特别相关;其他协议有单独的关注和限制(即SPDY,TLS,HTTP 2)。
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 web app in Tab1 of their browser, then also tries loading it in Tab2, they've used up the two allowed connections to my site.
I think I can do some wildcard domain thing, where I have my http server resolve any address to my site like:
*.mysite.com/webapp -> 123.456.789.1 (the actual ip of my server)
so:
a.mysite.com/webapp
b.mysite.com/webapp
c.mysite.com/webapp
all still point to (www.mysite.com/webapp) but the browser considers them different domains, so I don't run into the 2 connection limit. Is this true?
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.mysite.com/webapp
2) www.download.com/hugefile.zip
3) b.mysite.com/webapp
4) c.mysite.com/webapp
...
24) x.mysite.com/webapp
25) // Error - all 24 possible connections currently in use!
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
Chrome: 6
The limit is per-server/proxy, so your wildcard scheme will work.
FYI: this is specifically related to HTTP 1.1; other protocols have separate concerns and limitations (i.e., SPDY, TLS, HTTP 2).
这篇关于浏览器中最大并行http连接数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!