JDK-6996266 : Performance issue on BasicService.showDocument
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 6u21
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2010-10-29
  • Updated: 2012-08-16
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u25-revFixed 7 b126Fixed
Related Reports
Relates :  
Description
* FULL PRODUCT VERSION :
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot(TM) 64-Bit Server VM (build 17.0-b17, mixed mode)

* ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [version 6.1.7600]
Microsoft Windows XP [version 5.1.2600]

* A DESCRIPTION OF THE PROBLEM :
We identified a performance regression affecting any version of Java 6 compared to Java 5.

Using Java 5, a call to BasicService.showDocument takes few milliseconds, using java 6, it takes more than 5 seconds.

* STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simply use the showDocument method in a Java WebStart application, capture the time this method takes to execute.

* EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Trace of the provided sample code using Java 5 (any version)

Write file on disk jsp.txt = 15ms
Basic service lookup  : 0ms
Show document with Java webstart  (jsp.txt) = 0ms
ACTUAL -
Trace of the provided sample code using Java 6 (any version):

Write file on disk jsp.txt = 47ms
Basic service lookup  : 0ms
Show document with Java webstart  (jsp.txt) = 4531ms

* REPRODUCIBILITY :
This bug can be reproduced always. A full test case is attached:

---------- BEGIN SOURCE ----------
Here is an excerpt of an application that recreates the problem.

long startBasicServiceLookup = System.currentTimeMillis();
BasicService bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
long endBasicServiceLookup = System.currentTimeMillis();
log.append("Basic service lookup  : " + (endBasicServiceLookup-startBasicServiceLookup) + "ms"+newline);
                     
long startShowDocument = System.currentTimeMillis();
bs.showDocument(file);
                     
                  
long endShowDocument = System.currentTimeMillis();
log.append("Show document with Java webstart  ("+ fileContents.getName() +") = " + (endShowDocument-startShowDocument) + "ms"+newline);
---------- END SOURCE ----------

Comments
SUGGESTED FIX webrev: http://sa.sfbay.sun.com/projects/deployment_data/7/6996266.2 testcase (manual): http://web-east.east/deployment/www/tests/1.7.0/6996266/testcase.html
07-01-2011

EVALUATION It should be simple to implement both a) and b) above, and that should be enough. If the url ends in .jnlp, or is in the cache, continue with the code at the top of BasicServiceImpl.showDocumentHelper(), If neither, skip the check for accellerated jnlp launch, and proceed with the normal case at the bottom of BasicServiceImpl.showDocumentHelper(). If the file is in the cache, the check for the mime type in isJnlpUrl will not cause a web request.
05-01-2011

EVALUATION May be we should revert fix made in JDK6 and be less aggressive here. What we can do: a) use ".jnlp" extension as hint to launch using javaws. Moreover, it it is .jnlp then we can request it to be loaded to the cache and check mime type, if it is not JNLP then we can backup to browser. This will still have negatively impact but only for URLs with JNLP extension that are not really JNLP files. b) Check cache. If this URL is in the deployment cache and it is indeed JNLP then we should launch directly c) May be introduce new method to launch JNLP app using one of services
05-01-2011

EVALUATION This performance issue is due to the fix for 6274484 (ShowDoccument(".../...jnlp") should not bring up browser) in jdk 6 fcs where we based on the showDocument url to perform a head request in order to obtain the mime type. If the mime type is of jnlp type, we don't open a browser window.
23-11-2010

EVALUATION I've a simple jnlp testcase which uses BasicService.showDocument. Below lists the various performance measurement on BasicService.showDocument from differet JRE versions. All numbers are in the unit of ms. JRE | times for few runs ---------------------------------- 1.7.0 ea | 866 78 78 782 1.6.0_24 b01 | 1125 94 156 218 125 1.5.0_23 | 266 109 15 15 While the data shows that 5 update release has the best performance, the performance issue in 6 update isn't as bad as it was described. Attached is the simple testcase used to obtain the above data.
18-11-2010