Node.js vs. GraalVM - weixingsun/perf_tuning_results GitHub Wiki
GraalVM is a neat project, which provide options to use many other languages sit on JVM.
Node.js is known for using Google's V8 engine, which is innovative to create various open source projects
Let's do a very simple fibo benchmark on both:
Environment:
CPU: Intel 8180 2.5GHz (only bind to 1 lcore)
OS: RHEL7.5 (Meltdown & Spectre variant 3 patched)
src/node/application.js (same workload)
test/node/test_v8.sh
test/node/test_graal.sh
########################################################################### Test Results:
graalvm -- 144.037s (1g,2g,3g heap size are similar, minor GC rate= 1 time/s)
node-v8 -- 101.251s (default heap, , minor GC occurred only 2 times)
node-v8 perform +43% better than graalvm
GraalVM total GC time: 1030 ms, avg pause time: 9ms, throughput = 99.28%, garbage size = 193.58 gb
V8: almost no garbage !! stack allocation?
very small # of network traffic, mainly from lo
Both Node.js & GraalVM generated saturation workload on specific CPU:
###########################################################################
[root@dr1 jbb]# mpstat -P 3 3 3
Linux 3.10.0-862.11.6.el7.x86_64 (dr1) 11/15/2018 x86_64 (112 CPU)
07:27:43 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 07:27:46 PM 3 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:27:49 PM 3 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:27:52 PM 3 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 Average: 3 100.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
########################################################################### Future works
Syscall tracing
Bottleneck Profiling
########################################################################### V8 GC log
[26846:0x2ecaa20] Fast promotion mode: false survival rate: 8% [26846:0x2ecaa20] 103259 ms: Scavenge 9.9 (13.2) -> 8.3 (12.2) MB, 0.6 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure [26846:0x2ecaa20] Memory allocator, used: 12528 KB, available: 1478928 KB [26846:0x2ecaa20] Read-only space, used: 34 KB, available: 469 KB, committed: 512 KB [26846:0x2ecaa20] New space, used: 93 KB, available: 913 KB, committed: 1024 KB [26846:0x2ecaa20] Old space, used: 6708 KB, available: 315 KB, committed: 7396 KB [26846:0x2ecaa20] Code space, used: 861 KB, available: 0 KB, committed: 1024KB [26846:0x2ecaa20] Map space, used: 518 KB, available: 0 KB, committed: 1036 KB [26846:0x2ecaa20] Large object space, used: 243 KB, available: 1478407 KB, committed: 1536 KB [26846:0x2ecaa20] All spaces, used: 8459 KB, available: 1480105 KB, committed: 12528KB [26846:0x2ecaa20] External memory reported: 24 KB [26846:0x2ecaa20] External memory global 0 KB [26846:0x2ecaa20] Total time spent in GC : 7.8 ms
########################################################################### GraalVM GC log
... ... 155.818: [GC (Allocation Failure) 155.818: [DefNew: 1678120K->245K(1887488K), 0.0028295 secs] 1729753K->51906K(2936064K), 0.0028564 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 156.945: [GC (Allocation Failure) 156.945: [DefNew: 1678069K->229K(1887488K), 0.0030152 secs] 1729730K->51924K(2936064K), 0.0030411 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 158.075: [GC (Allocation Failure) 158.075: [DefNew: 1678053K->221K(1887488K), 0.0026131 secs] 1729748K->51924K(2936064K), 0.0026368 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 159.241: [GC (Allocation Failure) 159.241: [DefNew: 1678045K->229K(1887488K), 0.0028092 secs] 1729748K->51952K(2936064K), 0.0028362 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 160.394: [GC (Allocation Failure) 160.394: [DefNew: 1678053K->235K(1887488K), 0.0026897 secs] 1729776K->51959K(2936064K), 0.0027141 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
Heap def new generation total 1887488K, used 1040140K [0x0000000700000000, 0x0000000780000000, 0x0000000780000000) eden space 1677824K, 61% used [0x0000000700000000, 0x000000073f788548, 0x0000000766680000) from space 209664K, 0% used [0x0000000773340000, 0x000000077337ae80, 0x0000000780000000) to space 209664K, 0% used [0x0000000766680000, 0x0000000766680000, 0x0000000773340000) tenured generation total 1048576K, used 51723K [0x0000000780000000, 0x00000007c0000000, 0x00000007c0000000) the space 1048576K, 4% used [0x0000000780000000, 0x0000000783282f08, 0x0000000783283000, 0x00000007c0000000) Metaspace used 44149K, capacity 45148K, committed 45440K, reserved 1089536K class space used 5008K, capacity 5239K, committed 5248K, reserved 1048576K