'HTTP simultaneous connections per host limit... are per tab, browser instance or global?

According to the HTTP Specification (w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4), HTTP clients should limit their connections:

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.

Different vendors implement this limit differently: http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/

But. does this limitation applies per tab, per browser instance or globally for all the instances of the browser? Are pop-ups (dialogs) considered part of a tab or independent tabs?

Same for websockets, does the limit on connections per origin applies per tab, browser instance or globally?



Solution 1:[1]

Browsers

The implementation details are bound to be different for different browsers, browser versions or internet connection speeds (IE8 uses 2 connections on dial-up and up to 6 otherwise).

Also, these limits are usually user-configurable (i.e. network.http.max-connections-per-server in Mozilla) and one shouldn't assume specific values based on the browser version. The actual value might be accessible to a script though, such as window.maxConnectionsPerServer in IE.

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

The only relevant piece of information I found was this regarding 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

More current data about browsers can be found at www.browserscope.org/?category=network

RFC

There is an updated draft which obsoletes RFC2616 (if approved). Citing the relevant part (from 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.

Solution 2:[2]

I've not exhaustively researched this... What I've found is that it ok for 1 computer to open lots of browsers or browser tabs and each tab will maintain an active websocket connection.

This, however is not the same for Server Side Events (SSEs or eventsource() ) http://www.html5rocks.com/en/tutorials/eventsource/basics/

I have read in various forums where people have problems with SSEs when more than x tabs are open (I think 6 in chrome), and this is because browsers limit the number of simultaneous connections to a single ip address.

And it is as if SSE hold the connection for the lifetime of the page. Whereas, with websockets this is not the case.

Solution 3:[3]

Wanted to share my recent observation with chrome:

I use EVENTSOURCE API to open a persistent http connection.

Hypertext Transfer Protocol -- HTTP/1.1: I could open 6 connections in one browser alone (by looping EVENTSOURCE 6 times) or by having 6 tabs open with one EVENTSOURCE I could open 6 new connections with incognito chrome on the same machine. Hypertext Transfer Protocol -- HTTP/2: more than 20 [in theory they say its 100] i did not try.

It feels like Chrome has a pool-of http(TCP) connections it can keep open at a time. This number is currently 6 [in case of protocol http 1.1] and 100 with http2 irrespective of tabs/same-tab.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2
Solution 3 Clister Dmello