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.
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)
so:
a.example.com/webapp
b.example.com/webapp
c.example.com/webapp
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?
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!
I just picked 24 connections/Firefox as an example.
There is no definitive answer to this, as each browser has its own configuration for this, and this configuration may be changed. If you search on the internet you can find ways to change this limit (usually they're branded as "performance enhancement methods.") It might be worth advising your users to do so if it is required by your website.
Doing testing on a page I saw this behavior:
Edit: Seems that firefox 4 should be able to do 15 connections but that's not the behavior I observed.
Looking at
about:config
on Firefox 33 on GNU/Linux (Ubuntu), and searchingconnections
I found:That is likely to answer the part is there any limit to the number of active connections per browser, across all domain
skipped two properties...
(interesting, seems like they are not limited per server but have a default value lower than global http connections)
The 2 concurrent requests is an intentional part of the design of many browsers. There is a standard out there that "good http clients" adhere to on purpose. Check out this RFC to see why.
Note that increasing a browser's max connections per server to an excessive number (as some sites suggest) can and does lock other users out of small sites with hosting plans that limit the total simultaneous connections on the server.
Various browsers have various limits for maximum connections per host name; you can find the exact numbers at http://www.browserscope.org/?category=network and here is an interesting article about connection limitations from web performance expert Steve Souders http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/