-
Type: Improvement
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Component/s: Automation
-
Release Notes Summary:Nashorn javascript compilation has been tuned
-
Tags:
-
Sprint:nxplatform #99
-
Story Points:1
It has been reported that nashorn compilation is slow on LTS 2021 (because of Java 11 and nashorn update) comparing to LTS 2019.
Lots of contention in:
http-nio-0.0.0.0-8080-exec-63" #911 daemon prio=5 os_prio=0 cpu=707203.15ms elapsed=19702.04s tid=0x00007fbc7c027800 nid=0x788d in Object.wait() [0x00007fbae69e5000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.20/Native Method) - waiting on <no object reference available> at java.lang.Object.wait(java.base@11.0.20/Object.java:328) at jdk.nashorn.internal.runtime.CompiledFunction.getValidOptimisticInvocation(jdk.scripting.nashorn@11.0.20/CompiledFunction.java:635) - waiting to re-lock in wait() <0x000000044d6962c0> (a jdk.nashorn.internal.runtime.CompiledFunction) at jdk.nashorn.internal.runtime.CompiledFunction.createFunctionInvocation(jdk.scripting.nashorn@11.0.20/CompiledFunction.java:677) at jdk.nashorn.internal.runtime.ScriptFunction.findCallMethod(jdk.scripting.nashorn@11.0.20/ScriptFunction.java:949) at jdk.nashorn.internal.runtime.ScriptObject.lookup(jdk.scripting.nashorn@11.0.20/ScriptObject.java:1880) at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(jdk.scripting.nashorn@11.0.20/NashornLinker.java:104) at
The optimistic types should be deactivated, this improves latency and scalability.
+++ b/nuxeo-features/nuxeo-automation/nuxeo-automation-scripting/src/main/java/org/nuxeo/automation/scripting/internals/AutomationScriptingServiceImpl.java @@ -176,7 +176,7 @@ public class AutomationScriptingServiceImpl implements AutomationScriptingServic protected ScriptEngine getScriptEngine(boolean cache, boolean filter) { NashornScriptEngineFactory nashorn = new NashornScriptEngineFactory(); String[] args = cache - ? new String[] { "-strict", "--optimistic-types=true", "--persistent-code-cache", + ? new String[] { "-strict", "--optimistic-types=false", "--persistent-code-cache", "--class-cache-size=50" } : new String[] { "-strict" };
- is related to
-
NXP-32342 Provide option to enable Nashorn optimistic typing
- Resolved