Bug 1396565

Summary: Performance issue with nashorn vs rhino in openjdk-1.7.0
Product: Red Hat Enterprise Linux 6 Reporter: Paulo Andrade <pandrade>
Component: java-1.8.0-openjdkAssignee: Roland Westrelin <rwestrel>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8CC: jvanek
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-16 08:12:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1397815    
Bug Blocks:    
Attachments:
Description Flags
1.7.0-perf.txt
none
1.8.0-perf.txt none

Description Paulo Andrade 2016-11-18 16:05:21 UTC
User has an environment that creates JavaScript "rules" and
executes them. It was noticed that with java-1.7.0-openjdk
using rhino it runs almost 20 times faster.

  A similar bug report to upstream exists at
https://bugs.openjdk.java.net/browse/JDK-8034959

[more information follow]

Comment 1 Paulo Andrade 2016-11-18 16:07:55 UTC
Created attachment 1221905 [details]
1.7.0-perf.txt

Sample perf output when running with java-1.7.0-openjdk (rhino)

Comment 2 Paulo Andrade 2016-11-18 16:11:25 UTC
Created attachment 1221907 [details]
1.8.0-perf.txt

Sample perf output when run with java-1.8.0-openjdk (nashorn)

Comment 7 Roland Westrelin 2016-11-21 10:38:55 UTC
User's test creates new short lived javascript functions that are executed in a loop. Nashorn is not designed to handle such workload efficiently: each new function is compiled to bytecodes so with nashorn a big part of this test's execution is spent spinning bytecodes. As pointed above this is a known issue upstream and it seems the recommendation is to use rhino with jdk 8:

https://wiki.openjdk.java.net/display/Nashorn/Using+Rhino+JSR-223+engine+with+JDK8

Comment 8 Paulo Andrade 2016-11-21 11:58:53 UTC
Should, or does rhel 6 and 7, already have a package with rhino ready
to use with jdk 8?

Comment 9 Paulo Andrade 2016-11-22 11:50:39 UTC
  Replying to myself, and adding needinfo.

https://admin.fedoraproject.org/pkgdb/package/rpms/rhino/

needs epel6 and epel7 branches, or, a rhel package. Should also update
to Rhino 1.7.7.1 released February 2, 2016.

Comment 10 Paulo Andrade 2016-12-05 12:35:20 UTC
Please ignore the request for rhino epel branch.
For some reason I did not find it was in rhel already.
So, the solution currently should be to use rhel rhino and
procedures described at
https://wiki.openjdk.java.net/display/Nashorn/Using+Rhino+JSR-223+engine+with+JDK8

Comment 11 Roland Westrelin 2016-12-15 12:33:17 UTC
Paulo: is there anything any more you need from us? Should we close that bug now that there's a workaround?

Comment 12 Paulo Andrade 2016-12-15 12:39:16 UTC
  Hi Roland,

  Yes, the bug can be closed. May thanks for your help.