Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified
Accepted Solution

HTTP connection limit

[ Edited ]

Hello guys'

 

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.

 

Tnx'

Message Edited by Raiden on 11-09-2008 10:27 PM
Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: HTTP connection limit

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?

Developer
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: HTTP connection limit

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.

 

Tnx Peter'

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: HTTP connection limit

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....

Developer
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: HTTP connection limit

Ok' Tnx Peter'

I'll test by 2 way that using one connection and 2 connections.

Then write test results.

 

Tnx again.

 

New Developer
Posts: 6
Registered: ‎09-08-2008
My Device: Not Specified

Re: HTTP connection limit

Try using buffering ----

 

Good luck

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: HTTP connection limit

Can you tell us how buffering will help, when the problem appears to be the "pipe" through which the data must flow?
New Developer
Posts: 6
Registered: ‎09-08-2008
My Device: Not Specified

Re: HTTP connection limit

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

Developer
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: HTTP connection limit

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 ? 

 

Tnx again'

Developer
Posts: 168
Registered: ‎11-01-2008
My Device: Galaxy S II

Re: HTTP connection limit

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.