Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get around browser's 6 concurrent connections per domain limit?

As the title says, how do I get around a browser's 6 connections per domain limit?

I have a web app that needs to download data from the server as quickly as possible. Currently, I have up to about a dozen connections being opened at once, but in the network tab I see that several of the connections are stalled (Chrome) or blocked (Firefox) shown in gray:

enter image description here

After some digging around I believe this is due to Chrome's 6 connections per domain limit. How do I get around this?

After some searching, I have some reason to believe that one of these options may work, but I would like to know which option is the best (not a hack):

  • Use several subdomains (a.mysite.com, b.mysite.com etc...) and point them to the main server so that Chrome believes that they are different sites. This sounds like the most "hacky" option in my opinion and I don't know how long this will actually work for.
  • Some answers suggest that HTTP2 isn't restricted by the 6 connection limit, but when I look into using HTTP2 it seems like if the browser supports it then it will use it. So I guess this doesn't actually work since I'm still getting the stalled message in Chrome's most recent version.
  • I'm currently using fetch to get a stream of data from the server, would using Web Sockets or WebRTC instead not be limited by the 6 connection limit?

What other options are there?

like image 315
now_world Avatar asked Oct 28 '25 13:10

now_world


1 Answers

I don't think webRTC is limited to 6 connections per domain, since it is often used for P2P mesh connections where that restriction would make no sense.

But I'd be surprised if you got better performance out of 20 datachannels than one HTTP2 connection since the webRTC datachannel is really not optimized for throughput.

You might also want to look at using Service Workers to work around the problem in a different way.

like image 126
Tim Panton Avatar answered Oct 31 '25 02:10

Tim Panton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!