Open nmondal opened 4 months ago
Please note that this is not about graalvm being slower ( which it is - around 12+% with respect to Temurin 21.).
We also ran another end point /hello/z
and the comparison is as follows:
Running 30s test @ http://127.0.0.1:5003/hello/z
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 7.56ms 35.67ms 889.61ms 97.87%
Req/Sec 10.06k 1.95k 47.71k 90.00%
Latency Distribution
50% 3.61ms
75% 3.79ms
90% 4.28ms
99% 148.73ms
3585205 requests in 30.09s, 581.25MB read
Requests/sec: 119146.64
Transfer/sec: 19.32MB
Running 30s test @ http://127.0.0.1:5003/hello/z
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.82ms 13.06ms 394.50ms 99.37%
Req/Sec 11.04k 1.63k 36.14k 94.03%
Latency Distribution
50% 3.34ms
75% 3.49ms
90% 3.68ms
99% 8.55ms
3939720 requests in 30.10s, 638.73MB read
Requests/sec: 130887.98
Transfer/sec: 21.22MB
Thus the slowness in the fist comment is entirely due to graalvm's way pf handling script engines and loading and running compiled scripts.
Did you test GraalJS with Temurin as well?
Did you test GraalJS with Temurin as well?
No.. I ran Graal against Graal and.. Rhino in Temurin! Sure I can try running Graal in Temurin.
Did you test GraalJS with Temurin as well?
No.. I ran Graal against Graal and.. Rhino in Temurin! Sure I can try running Graal in Temurin.
Or maybe just change the title to “GraalJS on GraalVm slower than Rhino on Temurin”. I do suspect it is caused be the scaffolding, maybe creating engine and context is the slow part, not the execution. Maybe you can measure that separately? (Or is that what your /z test is saying?)
We have this https://github.com/nmondal/cowj where we use js engines. We have ran some tests and in summary, when we use Graal Script Engine + GraalVM, it is very, very slow compared to Rhino + Temurin 21 VM.
To reproduce:
graal
gradle clean build -x test
app/build/libs
folder andjava -jar cowj-0.1-SNAPSHOT.jar ../../samples/hello/hello.yaml true
gava -Dpolyglot.js.nashorn-compat=true -jar cowj-0.1-SNAPSHOT.jar ../../samples/hello/hello.yaml true
wrk --latency -t12 -c400 -d30s http://127.0.0.1:5003/hello/j
We used
wrk
tool from here ( https://github.com/wg/wrk )The script file
hello.js
contains the following:It just returns "hello, world!"
We found out that graal is very slow compared to Rhino.
Attached are the benchmark results. In summary, the best performance for these two:
GRAAL
Rhino
This is a HUGE gap, order of magnitude high gap.
Notes
Build was done using temurin open jdk 21
graalvm.perf.txt rhino.perf.txt