0

I'm developing a service where people can stream multiple audio files at the same time.

Unfortunately, when streaming about 4 streams simultaneously, Chrome's HTTP connection limit seems to kick in: new stream requests only arive at the server when a previous connection was closed.

Interestingly enough, I can play 10+ videos at the same time on YouTube.

What kind of technique could YouTube have used here to circumvent the browser's simultaneous http connection limit?

Tom
  • 8,536
  • 31
  • 133
  • 232

1 Answers1

1

The crucial point here I suppose is that YouTube streams are not directly controlled by the browser, they are embedded Flash players which use streams that are handled by Flash. If you want to hand off the streaming process to an external app/library (Flash, Java etc) you can circumvent these limitations quite easily.

The other point is that YouTube has a huge CDN, so there is no guarantee you're getting any two videos from the same server, which would also help to circumvent concurrency limitations (to a point, at least).

I'm not surprised that Chrome stops you after a while because Google did a load of research and experiments regarding browser concurrency and relative efficiency a while ago, and I remember reading somewhere that they concluded that 3-4 concurrent connections to the same server represented the the most efficient data transfer architecture over straight HTTP. Annoyingly, I can't find a reputable source to reference with that (although I got it from one in the first place), however this is related and probably part of the same research program.

This is also the sort of research Facebook get quite heavily involved in, and you might find some useful information in over at http://developers.facebook.com/ if you can be bothered sifting through the rubbish to find it...

DaveRandom
  • 87,921
  • 11
  • 154
  • 174
  • Surprisingly, both my uploading and sound streaming libraries use Flash. I may have hit on some other issue causing problems with simultaneous http connections. In any way, further requests are not arriving on the server side. Since the problem is probably somewhere else I will accept your answer. Unfortunately, I have no idea where to look now. – Tom Aug 20 '11 at 11:20
  • Now that I debugged more, it __has__ to be a simultaneous connection limit, because it is being queued as it will arrive at the server after a while. I am also definitely sure that it is using flash. Are you sure this issue doesn't apply with flash? It does seem to be apparent here. – Tom Aug 20 '11 at 11:37
  • To be honest, this is not a problem I've ever run up against before, because the media streaming apps I have dealt with make a maximum of 1 playing request and 2 caching requests at any one time - this is all that's required because you are only playing one stream at once. What exactly are you needing to do? Could you combine the streams at the server side to reduce the number of requests? – DaveRandom Aug 20 '11 at 11:46
  • Just done a bit more poking around on this subject, and it looks like 4 is your lot. The trick that people seem to use to get around this is to use a CDN, or emulate one. Have a look at [this](http://stackoverflow.com/questions/561046/how-many-concurrent-ajax-xmlhttprequest-requests-are-allowed-in-popular-browser) question - it is related to AJAX but I suspect the same applies to what you are doing. If you have the power to create more subdomains, you can add them as virtual host aliases on your server and put some code into the client side to limit the number of requests per domain to 4. – DaveRandom Aug 20 '11 at 11:58
  • This is confusing though. I do have one open websocket connection (this is TCP, not HTTP). The other requests are done by flash, which should not be affected like you said. I will return if I find out more, but for now I am absolutely puzzled. – Tom Aug 20 '11 at 13:07
  • I would be interested to know how you get on with this - I will have a play around myself when I get some time to do it... – DaveRandom Aug 20 '11 at 13:12
  • It does not seem to be possible to monitor all currently open connections with Firebug or Chrome Dev tools, correct? – Tom Aug 20 '11 at 13:14
  • @DaveRandom let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/2690/discussion-between-tom-and-daverandom) – Tom Aug 20 '11 at 13:21