Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDK 1.4 Slow SSL Connections

843811May 22 2002 — edited Apr 23 2003
Hi, I'm noticing a major performance problem with SSL in JDK 1.4. After running the two test programs below one in JDK1.4 and one with jdk1.3
everything else is the same web server,keystores I get the below listed time results.

The first connection is always slow as ssl initializes, but with the 1.3 jdk I get decent timing numbers for each connection thereafter.
As you can see below the jdk 1.4 is taking forever(3000ms vs 60ms) to complete a page download albeit it is still faster than the initial connection.

Test Stats:
Running on Windows 2000 connecting to a tomcat 4.0.3 ssl server with a self generated key created with keytool algorithm is MD5withRSA.

I assume I'm missing some ssl config parameter for jdk1.4 which is causing things to go so slow.

Any help is much appreciated.
Rob

JDK 1.4
-----------------------------
1st conn : 11938ms
2nd: 3109ms
3rd : 3125ms

JDK1.3
----------------
1st conn: 6047ms
2nd: 62ms
3rd: 47ms

*************************** JDK 1.3 *************************
import java.net.*;
import java.io.*;
import javax.net.ssl.*;
import java.security.Security;
import com.sun.net.ssl.internal.ssl.Provider;

public class SSL13 {
public static void main(String args[]) {
try {
System.setProperty("javax.net.ssl.trustStore","client.keystore");
System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new Provider());
URL url=new URL("https://XXX.XXX.XXX.XXX:443");
FileUtil.writeStreamToFile(url.openStream(),"test.html");
FileUtil.writeStreamToFile(url.openStream(),"test.html");
FileUtil.writeStreamToFile(url.openStream(),"test.html");
} catch (Exception e) {
e.printStackTrace();
}
}
}

*************************** JDK 1.4 *************************
import java.net.*;
import java.io.*;

public class SSL14 {
public static void main(String args[]) {
try {
System.setProperty("javax.net.ssl.trustStore","client.keystore");
URL url=new URL("https://XXX.XXX.XXX.XXX:443");
FileUtil.writeStreamToFile(url.openStream(),"test.html");
FileUtil.writeStreamToFile(url.openStream(),"test.html");
FileUtil.writeStreamToFile(url.openStream(),"test.html");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 21 2003
Added on May 22 2002
2 comments
254 views