Max parallel HTTP connections in a browser?
Asked Answered
G

11

586

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.

Ginger answered 12/6, 2009 at 7:23 Comment(3)
See also How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?Rectitude
yes it's called domain sharding which is an obsolete strategy in the age of HTTP/2Note
The solution here is to have only one suspended connection for all your tab updates. When a tab is opened, a request for updates for that tab is sent to the server, and the tab listens on the main suspended connection for any updates, and only picks up the ones it is interested in. I know this is not what you're asking, but thought it might be useful for someone. :-)Schmo
K
513

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.

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

Klipspringer answered 12/6, 2009 at 8:59 Comment(16)
I'm surprised. Doesn't the HTTP 1.1 RFC say to limit persistent connections to 2 per server?Leela
Yes it does. Recent browsers don't conform anymore.Klipspringer
@Adrian McCarthy: IE8 explicitly broke that standard, mainly because it wants to load pages more quickly. Firefox figured that out a bit earlier.Holotype
Citation(s) for these limits?Graminivorous
@Klipspringer - isn't this technically per domain rather than per per-server/proxy? (multiple domains may resolve to the same servers, but the browser will still allow the extra connections)Almaraz
Are there are any limits on WebSockets connections per origin?Blanketing
Will two requests on the same domain with different ports count as simultaneous connections for the domain ?Fertilization
@Klipspringer Does this limit apply for UDP as well ?Behring
What are the hard limits? Ie, if you have 6 image CDNs then what's the max parallel connections? That would be separate server/proxy for that case.Collage
The limit of 2 connections per server has been removed from the HTTP 1.1 RFC: evertpot.com/http-11-updatedDemarche
@Behring UDP is completely independent of all this; it's a different depth in the network stack, and is connectionless and stateless. You can't even send UDP packets from a browser generally speaking (though you never know what browser makers are experimenting with).Ashly
Experimenting, they are... theregister.co.uk/2015/04/17/google_quic_test_resultsAnnoy
@Klipspringer In fairness, the spec says "SHOULD NOT", not "MUST NOT". "A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy." source: section 8.1.4 Practical Considerations @ tools.ietf.org/html/rfc2616#page-44Mullah
Citation for Chrome: code.google.com/p/chromium/codesearch#search/…Whoso
Can anybody confirm that the limit is per domain? Where is the standard that defines it? (I know, browsers break it, but I'd like to have a look; maybe they only overlook the number). I wish people stopped using the ambiguous expression "per server/proxy" (is it the ip? is it the domain?) and I'd like to know if this annoying ambiguity comes from the standard.Cocktail
Can browser really use these high values if it is restricted to a lower value at operating system level? Can browser override OS settings? Like in Windows you have got few registry settings (MaxConnectionsPerServer and MaxConnectionsPer1_0Server) which control the max connections per server as mentioned in this post : #2960556Fideicommissary
F
220

HTTP/1.1

IE 6 and 7:      2
IE 8:            6
IE 9:            6
IE 10:           8
IE 11:           8
Firefox 2:       2
Firefox 3:       6
Firefox 4 to 46: 6
Opera 9.63:      4
Opera 10:        8
Opera 11 and 12: 6
Chrome 1 and 2:  6
Chrome 3:        4
Chrome 4 to 23:  6
Safari 3 and 4:  4

source: http://p2p.wrox.com/book-professional-website-performance-optimizing-front-end-back-end-705/

HTTP/2(SPDY)

Multiplexed support(one single TCP connection for all requests)
Freemason answered 8/2, 2013 at 8:11 Comment(5)
A similar table can be found at http://sgdev-blog.blogspot.com/2014/01/maximum-concurrent-connection-to-same.htmlSynaesthesia
Can browser really use these high values if it is restricted to a lower value at operating system level? Can browser override OS settings? Like in Windows you have got few registry settings (MaxConnectionsPerServer and MaxConnectionsPer1_0Server) which control the max connections per server as mentioned in this post : #2960556Fideicommissary
That turned out to be a .NET programming specific issue. At any rate third party browsers implement their own HTTP support so won't be affected by Windows limits.Pyorrhea
So as it is common for Web-Browser to open several TCP (~ 6 parallel) connections per host to load the different resources faster with HTTP 1.1, this is not the case anymore for HTTP/2 as multiplexing gains the same speed over one TCP connection?Overhead
Good information. HTTP/1 to HTTP/2 to HTTP/3 youtube.com/watch?v=a-sBfyiXysICirenaica
A
175
 BrowserVersion | ConnectionsPerHostname | MaxConnections
----------------------------------------------------------
 Chrome34/32    | 6                      | 10
 IE9            | 6                      | 35
 IE10           | 8                      | 17
 IE11           | 13                     | 17
 Firefox27/26   | 6                      | 17
 Safari7.0.1    | 6                      | 17
 Android4       | 6                      | 17
 ChromeMobile18 | 6                      | 16
 IE Mobile9     | 6                      | 60

The first value is ConnectionsPerHostname and the second value is MaxConnections.

Source: http://www.browserscope.org/?category=network&v=top

Note: ConnectionsPerHostname is the maximum number of concurrent http requests that browsers will make to the same domain. To increase the number of concurrent connections, one can host resources (e.g. images) in different domains. However, you cannot exceed MaxConnections, the maximum number of connections a browser will open in total - across all domains.

2020 Update

Number of parallel connections per browser

| Browser              | Connections per Domain         | Max Connections                |
| -------------------- | ------------------------------ | ------------------------------ |
| Chrome 81            | 6 [^note1]                     | 256[^note2]                    |
| Edge 18              | *same as Internet Explorer 11* | *same as Internet Explorer 11* |
| Firefox 68           | 9 [^note1] or 6 [^note3]       | 1000+[^note2]                  |
| Internet Explorer 11 | 12 [^note4]                    | 1000+[^note2]                  |
| Safari 13            | 6 [^note1]                     | 1000+[^note2]                  |
  • [^note1]: tested with 72 requests , 1 domain(127.0.0.1)
  • [^note2]: tested with 1002 requests, 6 requests per domain * 167 domains (127.0.0.*)
  • [^note3]: when called in async context, e.g. in callback of setTimeout, + requestAnimationFrame, then...
  • [^note4]: of which the last 6 are follow-ups (2,4,6 available at 0.5s,1s,1.5s respectively)
Alessi answered 5/5, 2015 at 22:56 Comment(7)
As of version 50+ Chrome now supports a maximum of 17 Max Connections, bringing it on a par with Firefox and Safari.Iceskate
I think this answer is a bit misleading. Host and domain are completely different. ConnectionsPerHostname means per subdomain. So if there are 2 sub domains it uses additional connections.if no subdomain then it means per domain.Soldierly
Is this limit per chrome tab? Or All tabs in a single instance of Chrome? Or all tabs across all instances of Chrome?Facture
Is it possible for a website require so many resources that all 81 connections be used simultaneously? I mean with the same server, website may require more that 81 resources, doesn't mean it requires 81 connections to fetch the efficiently.Register
Anyone have alterntives to browserscope to test this, looks like tooling is no longer hosted.Nonfulfillment
@Don Dilanga, a "subdomain" is just a word used to describe a domain in some contexts. The specific meaning of "subdomain" is only relevant for a few old Web technologies such as cookies. The more appropriate term is "host", as addresses count too. But for the purposes of this Q&A, domain = subdomain = host. Of course, they're all wrong, as in practice it's really about the origin: scheme, host, and port. The (now defunct) HTTP/1.1 spec itself used none of those terms but rather the phrase "server or proxy".Crony
Do you have an update for 2023, especially chrome? I feel that it became higher...Chladek
U
42

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/

Umbilicate answered 15/5, 2011 at 21:55 Comment(1)
Anyone have alterntives to browserscope to test this, looks like tooling is no longer hosted.Nonfulfillment
I
16

Firefox stores that number in this setting (you find it in about:config): network.http.max-connections-per-server

For the max connections, Firefox stores that in this setting: network.http.max-connections

Isatin answered 27/8, 2010 at 16:34 Comment(2)
network.http.max-connections is 900 by default, which does not relate to the maximum number of parallel connections which through testing of version 52 is still 17.Allamerican
it's network.http.max-persistent-connections-per-server actuallyMatey
S
7

Looking at about:config on Firefox 33 on GNU/Linux (Ubuntu), and searching connections I found:

network.http.max-connections: 256

That is likely to answer the part is there any limit to the number of active connections per browser, across all domain

network.http.max-persistent-connections-per-proxy: 32

network.http.max-persistent-connections-per-server: 6

skipped two properties...

network.websocket.max-connections: 200

(interesting, seems like they are not limited per server but have a default value lower than global http connections)

Sula answered 12/11, 2014 at 9:17 Comment(0)
H
4

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.

Henriettahenriette answered 12/6, 2009 at 13:6 Comment(3)
I agree, it would probably be best to follow the standard.Isatin
Following standards is good, but so is applying common sense and participating in revising those: see trac.tools.ietf.org/wg/httpbis/trac/ticket/131Underlying
Good point @JulianReschke, but with HTTP/2 it's not required anymore to have a high number of connections per host. See: http2.github.io/faq/#why-just-one-tcp-connectionAmbert
P
4

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.

Polynesia answered 8/11, 2010 at 18:41 Comment(0)
O
1
  1. Yes, wildcard domain will work for you.
  2. Not aware of any limits on connections. Limits if any will be browser specific.
Odrick answered 12/6, 2009 at 7:27 Comment(0)
R
0

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.

Rudiger answered 12/6, 2009 at 7:26 Comment(2)
I repeat, this is not configurable on the browser - or it may be, but still won't have any effect. It is the server that is enforcing the 2 connections per client, not the client nor the browser on the client. Increasing the connections on the browser will allow you to have 2 connections to more distinct servers (i.e. you could be downloading from several servers at a time, no problem). You could not, however, be downloading more than 2 files from any single server at the same time. In order to do that, the server must be modified.Serenaserenade
Granted this answer is outdated, but it's accurate as of the time it was written. First, servers rarely significantly limit connections per IP, so I think you're wrong there. Second, in 2009, IE 7 was still around and it had a maximum of two connections per host name. This was configurable via the system registry. Even today, browsers have limits, and they are often configurable, but those limits are much higher than they back then. Anyway, with the advent of SPDY/HTTP2 this has become a significantly smaller problem as servers and browsers implement the new protocol.Rudiger
S
0

My understanding is that the connection limit is not changeable on the client side. The connection limit must be changed on the server to have any effect. By default, many servers will only allow 2 connections per unique client.

The client is not the browser, it is the client machine issuing the TCP/IP requests.

To see the effect very clearly, use something like JMeter to fire off a bunch of web service calls to your server host - it will accept the first two and will not accept another until one of the two is completed. The amazing thing about this is that for a SOA shop, this is critical, yet hardly anyone is really aware of it.

Serenaserenade answered 30/9, 2015 at 20:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.