Increasing Google Chrome's max-connections-per-server limit to more than 6
Asked Answered
M

4

54

As far as I know, at the current moment, late 2011 the max-connections-per-server limit remains 6. Please correct me if I am wrong. This is bad that we cannot fix this easily as in Firefox. As far as I know this value is hardcoded.

One of the solutions is to download the Chromium's sources and rebuild them. Is there a more easy solution?

Is there any tricky way to hack this without creating a dozen of mirror-domains?

Why I'm asking the question: My task is to create a html-javascript slideshow that will run inside a fullscreened browser, and a huge monitor is hanging on the wall. The javascript is really complicated, it preloads photos and makes a lot of ajax calls to my web services. If WIFI connection is slow, if 6 photos are loading, the AJAX calls fail, the application runs bad. I want a fast solution based, on http or browser or ubuntu tweak something else, because rebuilding the javascript app will take days.

Offtopic: do you know any other things that can be tweaked in my concrete situation?

Malposition answered 6/12, 2011 at 17:57 Comment(8)
this appears to be the open enhancement request, but unfortunately they don't look eager to add the config option code.google.com/p/chromium/issues/detail?id=85323Legislator
If we could add "random mode" to SwitchySharp addon, we can seperate 25 requests into 25 proxy port connections simutaneously. It should work around the max-connections-per-server limit.Eberta
Well you can use firefox, and configure in about:config the network.http.max-persistent-connections-per-server configYard
You could put some of the images on a different server for static content, as well, and not have a single blocking point.Michalmichalak
Some of the links in this Q&A comment thread have aged poorly. Here's an archive link of why browsers/clients enforce max connections per servers: web.archive.org/web/20101228053711/http://… Also note: HTTP 2 multiplexing can help this a lot and is more widely supported since this question was first asked.Mountain
Here is a link to a chrome dev explaining WHY 6 connections: bugs.chromium.org/p/chromium/issues/detail?id=85323#c7Prager
What I wish they would allow is increasing the number of connections to the LOCALHOST/127.0.0.1. I'm building an application to be installed on a PC which uses the browser as the GUI. And it can greatly benefit from having multiple simultaneous connections. So currently I need to advise my users to use FireFox. Not a biggie but so this is my suggestion to Chrome: Allow more connections to localhost.Poulos
MaxConnectionsPerProxy is also somewhat relevant if there is a proxy. In macOS, it can set via defaults write com.google.Chrome MaxConnectionsPerProxy -int 99.Endodontics
C
29

IE is even worse with 2 connection per domain limit. But I wouldn't rely on fixing client browsers. Even if you have control over them, browsers like chrome will auto update and a future release might behave differently than you expect. I'd focus on solving the problem within your system design.

Your choices are to:

  1. Load the images in sequence so that only 1 or 2 XHR calls are active at a time (use the success event from the previous image to check if there are more images to download and start the next request).

  2. Use sub-domains like serverA.myphotoserver.com and serverB.myphotoserver.com. Each sub domain will have its own pool for connection limits. This means you could have 2 requests going to 5 different sub-domains if you wanted to. The downfall is that the photos will be cached according to these sub-domains. BTW, these don't need to be "mirror" domains, you can just make additional DNS pointers to the exact same website/server. This means you don't have the headache of administrating many servers, just one server with many DNS records.

Cristiecristin answered 6/12, 2011 at 18:11 Comment(3)
What I'll do: 1) increase TTL, 2)control pictures in a sequence using img.complete, 3)put urgent feeds to separate domainMalposition
3) And count the number of open connections inside my library, (that's simple!). Images are hungry, and can download up to 20 seconds, so I left only 4 of them to download simultaneously (putting in a chain), leaving 2 channels for feeds.Malposition
IE now supports up to 18 connections per host /fyi.Highfalutin
H
2

I don't know that you can do it in Chrome outside of Windows -- some Googling shows that Chrome (and therefore possibly Chromium) might respond well to a certain registry hack.

However, if you're just looking for a simple solution without modifying your code base, have you considered Firefox? In the about:config you can search for "network.http.max" and there are a few values in there that are definitely worth looking at.

Also, for a device that will not be moving (i.e. it is mounted in a fixed location) you should consider not using Wi-Fi (even a Home-Plug would be a step up as far as latency / stability / dropped connections go).

Highfalutin answered 3/10, 2012 at 21:5 Comment(3)
about:config::network.http.max-persistent-connections-per-server looked promising, but seemed to have no effect for my concurrent uploads test.Valueless
It works for me, saved the day on FireFox, but I would like to know how to change it on Chrome tooPoulos
@PanuLogic -- you could compile your own version of Chromium, perhaps with this line of code changed? -- Alas it appears to be hardcoded.Highfalutin
C
-1

BTW, HTTP 1/1 specification (RFC2616) suggests no more than 2 connections per server.

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. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.

Cuisine answered 13/3, 2014 at 18:22 Comment(4)
Yes, but RFC2616 is 18 years old so its recommendations should be taken with a grain of salt.Di
RFC2616 has been dead since 2014. It should not be relied upon for guidance. It was replaced, in its entirety by 6 RFCs: 7230, 7231,7232,7233,7234, and 7235. Remove RFC 2616 from your brain. It only exists as a historical artifact.Habitue
Just to add to what @K.AlanBates said, § 6.4 of RFC 7230 says "A client ought to limit the number of simultaneous open connections that it maintains 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.".Dineric
"specification does not mandate a particular maximum number of connections ... " Sounds very reasonable. But how to allow more connections on Chrome?Poulos
M
-3

There doesn't appear to be an external way to hack the behaviour of the executables.

You could modify the Chrome(ium) executables as this information is obviously compiled in. That approach brings a lot of problems with support and automatic upgrades so you probably want to avoid doing that. You also need to understand how to make the changes to the binaries which is not something most people can pick up in a few days.

If you compile your own browser you are creating a support issue for yourself as you are stuck with a specific revision. If you want to get new features and bug fixes you will have to recompile. All of this involves tracking Chrome development for bugs and build breakages - not something that a web developer should have to do.

I'd follow @BenSwayne's advice for now, but it might be worth thinking about doing some of the work outside of the client (the web browser) and putting it in a background process running on the same or different machines. This process can handle many more connections and you are just responsible for getting the data back from it. Since it is local(ish) you'll get results back quickly even with minimal connections.

Myeloid answered 6/12, 2011 at 18:22 Comment(6)
I recommend this answer. You should make a howto on how to edit the binary to this effect or even how to use a memory editor for it. Release a trainer on a cheats site for Chrome to do things like this. Chrome developers whine about people making unsupported configurations so lets make things an absolute hell for them.Quinquevalent
@jgmjgm: I have wanted to do this kind of thing in Chrom{e,ium} for a very long time, for unrelated reasons. I unfortunately know pretty much nothing about assembly language, C++ disassembly, etc. I do know this would need more than symbols though, I'd need to be able to find setting/option data in official+distro-compiled+user-compiled binaries on Linux, then there's 2 more platforms to take into account. (I'd only be testing Linux.) Where/how would you recommend I start hammering my head against this wall? :PSlavic
I think I might have been joking but I did a while back somehow manage to get around this with canary. I think I was able to turn off cross domain security or something then just create a thousand subdomains to the same host.Quinquevalent
This answer isn't helpful. Executables can always be edited.Prager
@Slavic ... this line of code looks promising to me.Highfalutin
See bugs.chromium.org/p/chromium/issues/detail?id=12066 for problems with making changes. This was linked from the source and has some good discussions.Myeloid

© 2022 - 2024 — McMap. All rights reserved.