I'm trying to simultaneously download multiple files. How am I to determine an optimal number of files to download in parallel?
-
From the same source? Do you have multiple Network cards? Can you starve other activities. In a client or on a server?. Bit more info mate. – Tony Hopkinson Feb 03 '13 at 10:07
-
@Tony Hopkinson, from different domains. – aush Feb 03 '13 at 10:09
-
2No one will answer this question better than you after making the number configurable and logging the efficiency stats. – Tomek Feb 03 '13 at 10:12
-
Also be aware that [the default limit for connections to the same IP is 2](http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.defaultconnectionlimit.aspx). – svick Feb 03 '13 at 10:15
3 Answers
Impossible to answer - that depends on many factory that are outside of your control, mostly latency, packet loss.
The optimal number will use up all bandwidth with as few connections as possible. This may vary, over time, over download location (same server, not) and may have limits imposed from the other side.
Make it configurable, start with something like 2-4 connections to start.

- 61,059
- 10
- 88
- 148
-
Is it possible to monitor a bandwidth usage? I don't want to test it, but user may specify a speed of his internet connection. – aush Feb 03 '13 at 10:14
-
It is possible, but then that may not be the limiting factor - the server may have a lower bandwidth limit than the user, and then you open additional downloads and achieve nothing. – TomTom Feb 03 '13 at 10:52
There are many components surrounding the issue. How many request the server (file host) can handle effectivly, what is the file size, what is the user pc specs, how many threads can it handle, and many more...
I would rather for simplicity leave this vairable as user configurable via UI so that user can set the value according to his own experince and needs.
To complement the existing answers: Latency at the server and network is very important. When the server takes 1000ms to respond you might need 100 connections to saturate the system.

- 168,620
- 35
- 240
- 369