Delay in SSL socket connection?

R

Rick Genter

I'm having a problem with an SSL socket connection taking a long time
to complete. I am using J2SE 1.4.2 and using the JSSE package included
therein. My code is lifted straight from the tutorials on how to use
JSSE. The problem I am facing boils down to the fact that the line of
code:

Socket socket = factory.createSocket(host, port);

typically takes 4.5 seconds to execute. This is between two machines
communicating over the Internet with a typical ping time of 30
milliseconds. Other (non-SSL) socket connections in the same
application between the same two machines are taking < 100
milliseconds. Occasionally the above line of code takes much LONGER to
execute; I've seen it take as long as 23 seconds.

Can anyone point me in a direction to try to improve the performance
of my application in this regard? Thanks.


Rick
 
R

Ronny Schuetz

Hi,

I guess you're validating the certificates for the SSL connection. Try
to write a custom Trustmanager for JSSE that caches validation results
for some time in memory, so that at least opening connection to the
same peer gets faster. For the initial connection, you cannot do much
probably.

Ciao,
Ronny

--
+----------------------------------+---------------------------------+
| Ronny Schuetz | Phone : +49-7031-14-4714 |
| Hewlett-Packard GmbH | Fax : +49-7031-14-2221 |
| Boeblingen / Germany | Telnet : 777-4714 |
| Enterprise Integration Solutions | Voicemail: 1392.1144714 |
| Platform Services | email : (e-mail address removed) |
+----------------------------------+---------------------------------+
 
E

EJP

You don't really need to do this as long as you keep using the same
SSLSession, which is what happens by default.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top