changing numConnections dynamcly

HomeForumsAssetLoaderGeneral Discussionchanging numConnections dynamcly

This topic has 2 voices, contains 1 reply, and was last updated by  Matan Uberstein 214 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
Author Posts
Author Posts
October 17, 2011 at 9:23 am #738 Quote

Asaf Kuller
<p>I am working on a project that the main swf is loading about 40 swf and around 100 mp3 files.</p>
<p>I am wondering what is best for my project: 1 connection, so each asset will load as fast as it can or lots of connection to load assents simultaneously? </p>
<p>I thinking on changing the number of connection dynamically (can it be done after call for .start()?). if the loading rate is good I will add more connection to use the good bandwidth, if not I will close connections.</p>
<p>all experience coders out there, what do you think?
</p>
October 17, 2011 at 9:51 am #871

Matan Uberstein

Hi Asaf,

Generally opening more connections is faster than loading 1 asset at time. This is because most webservers will only allow a client to transfer at a certain rate per connection. So when you are download heavy files like mp3s, videos etc, it’s better to have more connections. Also note that the modern browsers have a built in limit of 6 (correct me if I’m wrong) and legacy browsers have a limit of 2 connections per session.

You can monitor this and change the number of connections dynamically, but this would not be an easy task. If you do find a way of do this and you want to change numConnections to something else, just remember to call 1 again, as this is only point where numConnections is referenced. https://github.com/Matan/AssetLoader/blob/master/src/org/assetloader/AssetLoader.as#L93

If you’d like the browser to handle the number of connections opened, just 1 If your swf is running in the browser, otherwise leave it on 3 – I find 3 connections have the correct balance between connections and speed.

Oyes, another thing that multiple connections helps with is latency. E.g. Single connection: * sample values
- [Open connection] 500ms
– [Transfer] 2000ms
— [Close connection] 0ms
[Rinse and repeat]

Where as multiple connections have overlapping transfers and latency time, so at any given point you are transfer data to the client and not just waiting for the connection to open.

Hope that helps! Shout if you need anything else! :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.