02-25-2013 11:54 AM
I have an application that uses multiple SocketConnections.It downloads parts of the same file from 10 servers simultaneously (like Flashget). Each SocketConnection uses a separate thread,it requests one part from one server and waits for the answer.
I get following interesting facts. While using 1 thread, sniffer shows that request to server in real goes away after 2 seconds after flush.
By increasing the threads number to 10, "after the flush" delay is increased in proportion . It turns out that the speed of 1 and 10 threads is the same. That is despite the fact that socketconnection uses 10 threads, it looks like they are working sequentially ,i mean that, until one thread with socketconnection not receive a response from the server, the second and subsequent can not send a new request.
02-25-2013 06:03 PM
Is this surprising? Having mutliple threads only increases through put if there is some overlap possible, which I suspect is unlikely to be the case over a wireless (non WiFi) connection.
02-26-2013 05:38 AM
This problem occurs with all transports.
Here's an example. My Blackberry can download with WiFi at 5 Mbps. 1 server has upload speed about 128kbit. So when i use one, five ten threads(servers) simultaneously , the total speed is approximately 128kbit-150kbit.
02-26-2013 05:45 AM
02-26-2013 05:51 AM
02-26-2013 06:45 AM
But I still not convinced that you should see any improvement using multiple threads. If all the Threads are doing is downloading, why should multiple downloads get better throughput? If you did, this would suggest that the communication method reserves some bandwidth for second or subsequent connections - and why would it do that?
For me, the only way you will see throughput benefit from multi-threading is when there is overlap of activities using different resources - for example, while you are writing the data to the SD Card from one download thread, then another download thread can be using the network.
And remember that there is only one processor on BB devices, so anything using the processor is blocking everything else.
Just out of interest, what size 'chunks' are you trying to download at a time?
02-26-2013 06:52 AM - edited 02-26-2013 06:53 AM
Multiple threads should increase the total download speed, because maximum speed of My phone(with wiffi) is 50 times bigger then upload speed of 1 server. So, according to the logic, it is clear that it is necessary to use 50 threads to fully load the phone speed. I tried chunks 4,8,16 kbyte.
02-26-2013 06:58 AM
02-27-2013 06:43 AM
I tried to remove all file operations and left only network threads. Downloading speed with wifi increased in 10 times, but BIS speed increased only in 2 times(is about upload speed of one server*2). But real download speed with BIS is much bigger(when downloading files from sites).