ssl createSocket slow on tomcat

  • Thread starter Marco Parmeggiani
  • Start date
M

Marco Parmeggiani

I create a client side ssl socket this way:

X509TrustManager xtm = new AWTrustManager();
TrustManager mytm[]={xtm};
SSLContext ctx = null;
ctx = SSLContext.getInstance("SSL");
ctx.init(null, mytm, null);
SocketFactory factory = ctx.getSocketFactory();
Socket s = factory.createSocket(shost, sporta);

if i use this code in a standalone application, createSocket returns in
about 1 second or less. If i execute it in a class used from a jsp under
tomcat, the operation takes 3/4 seconds...

i've monitored the connection on the server side (also written in java)
and i've seen that the ssl handshake is pretty fast. After the handshake
the server sends a string to the client then sits waiting for requests
from it. Meanwhile the client, even after the server has already sent
it's "welcome message", continues to stay locked on createSocket for 3/4
seconds then returns and the communication continues correctly...

i really don't know why i have this problem under tomcat.

i've also tested the connection without using ssl and ther is no
problem.

j2sdk 1.4.1_02
tomcat 4.0.6

thanks
ciao
 
R

Roedy Green

if i use this code in a standalone application, createSocket returns in
about 1 second or less. If i execute it in a class used from a jsp under
tomcat, the operation takes 3/4 seconds...

I am puzzled. If I read you literally you are distressed that Tomcat
is 0.25 seconds faster than it "should" be.

Is there a typo somewhere in your message?
 
M

Marco Parmeggiani

I am puzzled. If I read you literally you are distressed that Tomcat
is 0.25 seconds faster than it "should" be.

Is there a typo somewhere in your message?

LOL... 3/4... i mean 3 or 4 seconds, not 0.75. So, Tomcat is 3 or 4
times slower than it "should" be. Sorry, in my neighbourhood it's common
to write those numbers that way.

ciao
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top