Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
New Contributor
ferenc_tollas
Posts: 5
Registered: 03-04-2010
My Carrier: developer
Accepted Solution

HttpsConnection.open method is slow for ssl

Hi all,

I have a question related to the HttpsConnection. Our application would like to use the HttpsConnection class

to perform https requests to a server. Everything goes well, but we have experienced some issues with the 

speed. After several measurements we found out that the problem is with the Connector.open(url) method,

sometimes this needs 8-11 seconds to connect to the server. 

Sending/receiving data is fast, but the open() method is really slow. Do you have any ideas why this method

is so slow? Maybe the problem is with the ssl resumed handshaking? Can this cause the problem?The 3g

network is fast, there are no problem with that.

What is interesting, if I do 4 requests each after other, then the running time of the  open() method decreases - from 5 seconds to 1,3 second. If I wait now 40 seconds, and do another request, then the open method runs again for 5-8 seconds.

 

For the URL I have added the EndToEndRequired parameter, and we are going through BIS.

 

I would appreciate any help for this problem.

 

 

Thanks and Regards,

-Ferenc

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: HttpsConnection.open method is slow for ssl

I'm not an expert, but I can confirm that the open processing for a secure connection will be slow, because the two ends must agree on a secure pipe for the message.  According to documentation I have read, this can exchange between 5 and 8 messages.  So you should expect a significant delay in this processing.  Not because of the quantity of the data, but just because of the latency involved in receiving and responding to each message. 

 

Regarding your observation about the time for subsequent I can only assume that if you open a second connection shortly after the first, the subsequent session establishment is short circuited. 

 

Hope this helps.

Please use plain text.
New Contributor
mtmurdock
Posts: 2
Registered: 03-07-2011

Re: HttpsConnection.open method is slow for ssl

Yes, the ssl handshake does take longer than a non-secure http request, but this should NEVER take so long. I have developed apps for iOS and Android as well as Blackberry, and neither of them have such severe connection lag as does Blackberry. If an app needs to make several separate requests it becomes so slow that the device freezes and becomes unusable. There simply must be some way to speed this up, otherwise i cant see how Blackberry can be taken seriously as a secure platform.

 

Is there anyone out there that has learned how to speed up ssl on Blackberry?

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: HttpsConnection.open method is slow for ssl

Welcome to the forums.

 

"If an app needs to make several separate requests it becomes so slow that the device freezes and becomes unusable"

 

My immediate reaction to this statement is not that the processing is slow, just that you are doing this processing on the Event Thread and so are locking up the device.  So I would carefully review the way your code is written. 

 

I'm not saying it is wrong, but I would say that I have never managed to lock up a BlackBerry device doing background network processing. 

 

Remember too that a significant proportion of Blackberry devices sit on a BES and so do not need secure transport, at least to intranet locations, as the pipe is already encrypted.   

 

And of course I suspect a significant number of people (myself included) encrypt the data using the on board encryption rather than use SSL, because if the issues we have had getting access to port 443 through corporate firewalls. 

 

So even if SSL is slow, in my opinion this does not make BlackBerry an insecure platform.

Please use plain text.
New Contributor
mtmurdock
Posts: 2
Registered: 03-07-2011

Re: HttpsConnection.open method is slow for ssl

I am not doing that processing on the Event Thread. That would be silly. SSL is something that every platform needs to do, but Blackberry doesn't do well. I have implemented the same app on iOS and Android, and neither of them run this slow. In fact, on both of those platforms you can hardly tell the difference between an http and https request. Blackberry on the other hand runs significantly slower. This is a big problem and I am not the only person running into it. Forums are virtually flooded with simillar posts and for the most part the Blackberry Support Admins on those forums (including this one) just say, "Oh it must be your application." 

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: HttpsConnection.open method is slow for ssl

I'm sorry, I'm naturally skeptical when people make statements that do not tie up with my experience. 

 

As noted, I have never seen a Blackberry tied up by correctly coded background network processing.  And yes I have code that makes successive connections. 

 

I would be very happy to try a piece of code that did what you said happened, i.e. make several separate requests, so the device freezes and becomes unusable.  As noted, I can't supply this code, because the code I have does not break in this way.  So perhaps you could give us a small application that we can run on a device of our choice that will break it.  Source included, so that we can review what is going on. 

 

If we can demonstrate a problem then we can get RIM to fix it and that will help everyone. 

 

Given I have no evidence to the contrary, I am happy to take your word that other platforms do this better.  But that was not the point.  My point was that this 'slowness' does not make BlackBerry an insecure platform, which was your contention. 

 

And I don't see this forum flooded with similar posts - in fact this is the first I can remember that has commented on SSL performance. 

 

FYI, I am not a BlackBerry Support Admin, nor related to RIM except as a user.    I just try to be helpful. 

Please use plain text.