JAVA17’s GraalVM and HotSpot JVM showcase equally impressive performance feats - No one is a winner here
JAVA 17: GraalVM vs Oracle Hotspot JVM

JAVA17’s GraalVM and HotSpot JVM showcase equally impressive performance feats - No one is a winner here

Have been reading quite a bit of references about GraalVM performance.

It's been suggested as the best performance VM for serverless, cloud and microservcies.

So I thought to give it a try and compare it's performance with Oracel Hotspot JVM.

About GraalVM

GraalVM is high performance JDK and JRE developed by Oracle to improve and enhance execution of java applications.

It's key features:

  1. Graal compiler for advanced just-in-time compilations and dynamic optimizations.

  2. Ahead of time(AOT) compilation to native image.

  3. Multi language support and Polygot programming - supports multiple languages like javascript, ruby , Python.

Note: JIT and AOT features are not entirely new , these exist with open jdk and oracle jdk as well. Here, it's mentioned to be more enhanced and performance, resource efficient.

Installing Graal VM

Steps to install :

  1. Download graalVM jdk17 from here.

  2. Extract it

3. Move to path /opt/graalVm/

4. Set class paths

Switching to Graal VM

Now you need to switch to graalvm. For that use this command:

This will show you all java versions installed on your machine

1.1 Java versions installed on your machine

Select '0' as that's the graalVM and check your java version:

Your graalVM should reflect as below:

1.2 GraalVm set as current java runtime

Comparison of GraalVM with Oracle Hotspot JVM

Here we have , Average latency comparison for Spring boot api. I did it 3 times but did not find any improvement in performance.

1.3 Latency comparison

Chart for latency comparison:

Same can be analysed from the chart below - both GraalVM and Oracle Hotspot JVM delivers similar latency for spring boot api / microservice.

2. Chart for Latency Comparison

Let's walk through resource utilization as well for both runtimes in JAVA 17.

CPU Utilization:

Looking as CPU utilization, we can only observe GraalVM taking 10% more CPU in initial time period.

GraalVM CPU utilization

3. GraalVM CPU utilization

Oracle Hotspot CPU utilization

4. Oracle HotSpot CPU utilization

Heap Utilization:

Heap utilization is also similar for both except slightly higher heap utilization peaks in GraalVM.

GraalVM Heap utilization

5. GraalVM Heap utilization

Oracle Hotspot Heap utilization

6. Oracle HotSpot Heap utilization

GC Performance:

Coming to GC analysis, although nothing to conclude but as observation:

  1. Max pause is higher in GraalVM

  2. But CPU time if lower in GraalVM

7. Graalvm GC Comparison

Conclusion

This quick endeavour to test the waters doesn't find anyone as clear winner. Both JAVA 17 runtime environments delivers similar latency and resource utilization as well.

To view or add a comment, sign in

Others also viewed

Explore topics