-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
Describe GraalVM and your environment :
- GraalVM version or commit id if built from source: 22.3.3
- CE or EE: CE
- JDK version: JDK11
- OS and OS Version: ubuntu 20.04
- Architecture: amd64
- The output of
java -Xinternalversion:
**OpenJDK 64-Bit Server VM (11.0.20+8-jvmci-22.3-b22) for linux-amd64 JRE (11.0.20+8-jvmci-22.3-b22), built on Jul 19 2023 20:41:46 by "buildslave" with gcc 8.2.0**
Have you verified this issue still happens when using the latest snapshot?
You can find snapshot builds here: https://github.com/graalvm/graalvm-ce-dev-builds/releases
Describe the issue
During concurrent testing (100 threads), it was found that the CPU usage was excessively high, reaching nearly 300% on a 4-core CPU. Analysis revealed that three TruffleCompilerThread threads were responsible for this high usage. In the stress test code, both the context and the compilation results were cached to reduce redundant compilation.
Code snippet or code repository that reproduces the issue
Context context = contextManager.getContext(script, type);
Value value = context.getBindings("js").getMember(name);
if (value == null){
context.eval("js",script);
value = context.getBindings("js").getMember(name);
}
Object obj = value.execute(arguments).as(Object.class);
Object res = JSON.parse(JSON.toJSONString(obj));
return res;
Additional context
Current Invocation Method:java -jar -Dpolyglot.engine.OptimizationLevel=0 xxx.jar
Details
Threads Total: 327, NEW: 0, RUNNABLE: 55, BLOCKED: 4, WAITING: 80, TIMED_WAITING: 164, TERMINATED: 0, Internal threads: 24
ID NAME GROUP PRIORITY STATE %CPU DELTA_TIME TIME INTERRUPTED DAEMON
429 TruffleCompilerThread-429 main 10 RUNNABLE 99.71 0.204 13:22.927 false true
387 TruffleCompilerThread-387 main 10 RUNNABLE 99.59 0.204 13:22.452 false true
430 TruffleCompilerThread-430 main 10 RUNNABLE 98.72 0.202 13:22.234 false true