11-09-2008 10:22 PM - edited 11-09-2008 10:27 PM
My application creates HTTP connection. I want to increase speed for downloading content from web server. The contents consistes from many unit datas. In other word, I need to download 100 unit datas. Now, I am using the one connection for downloading these contents(100 unit datas). Its downloading speed is too slowly. I want to become it fast.
So, I think many connections can increase downloading data speed.
How many connections to have for one application in MAX ?
Do you have another way to increase downloading speed ?
Please share knowledge with me guys.
Solved! Go to Solution.
11-10-2008 05:57 AM
I believe, but have been unable to find referenced, that the maximum number of connections from the BB is 5, however it might be 4. That means if your application opens a connection in a Thread, there will be 3 (or 4) left for other applications on the BlackBerry.
However I'm not convinced that having multiple connections will make a huge difference unless your data items are small, or you can overlap activity on one connection with some other processing. My gut reaction is that the data link on the BlackBerry will only be used by one connection at a time.
You could bulk your data up and try to send it in one connection. However I'm not sure I'd recommend this. The chances of there being a phone call in the middle of a long connection are high and I think you would have to redo the whole lot unless you have some fancy restart logic. However this method will allow you to do some compression, which could speed things up. A BES connection will do some compression for you, but if you are connecting any other way I don't think the data is compressed.
Can you give us a little more info about the size of data you are sending and the performance you are currently seeing?
11-10-2008 09:51 PM
Tnx for your response. My downloading unit data is compressed and its size approximately 19Kbytes. Unit data number is 100. And the application opens in a Thread. So, I think the best solution is 3 connections for my application.
I'll try it.
11-11-2008 06:37 AM
I have recently done some performance testing for a real time application here. Basically on a GSM GPRS network (all we have in the UK) without EDGE, I could get about 1K per sec. So with a single connection you should get your lot down in under 20 seconds.
As I said, I don't think multiple connections will help you because:
a) I believe there is only one underlying communication method and so any packet you use for one connection is stealing that packet from another connection
b) I suspect there is a significant amount of overhead establishing the connection and the latency that involves.
Please let us know how it goes....
11-25-2008 08:57 AM
I guess in your case device is pulling data via a inputstream, intention is not to read stream byte by byte,
buffered streams help one to fetch few kebs at a time. I m fetching 4kb in one IO attempt on stream.
-- hope this will help.
if you u have something to more in this, pl share :thanks
11-26-2008 11:16 PM
Tnx for your response.
I gonna try your idea. So, Do I need to use buffered streams instead of InputStream ?
If you have example code using buffered Stream, plz share me ?
11-27-2008 04:22 AM
The InputStream returned by HttpConnection.openInputStream() is already a buffered stream. Just invoke InputStream.available() and you'll see what I mean. After all, the underlying network doesn't deliver data on byte at a time - it delivers data one packet at a time.