Using the OpenJ9 JVM for Quarkus Applications

DZone 's Guide to

Using the OpenJ9 JVM for Quarkus Applications

In this article, see how to use OpenJ9 JVM for Quarkus applications and see the memory usage results.

· Java Zone ·
Free Resource

As defined on the home page, Quarkus is “a Kubernetes Native Java stack tailored for OpenJDK HotSpot and GraalVM.” Since I’m a big fan of OpenJ9, I’ve quickly measured memory usage of my reactive sample application where I run a microservice once with OpenJ9 and once with HotSpot.

OpenJ9 is a Java JVM that was open sourced from IBM 2-3 years ago. It’s basically the same JVM that IBM uses in hundreds of products and offerings. The nice thing is that compared to Hotspot, it not only provides a 42% faster startup time, but also a 66% smaller memory footprint. Check out the documentation.

I’ve used OpenJ9 from AdoptOpenJDK where you can choose between HotSpot and OpenJ9. Read my previous blog to understand what other advantages AdoptOpenJDK provides.

You might also want to read: Thoughts on Quarkus

Memory Usage Results

Here are the results of my little test. The diagram is from the Quarkus website. Everything that is in orange is what I’ve added for OpenJ9.

Memory in megabytes visual

I’ve run the same service which accesses a database with OpenJ9 and HotSpot. I’ve deployed the two versions of the service from scratch and warmed them up by invoking their REST APIs. After this I invoked “docker stats | grep articles-reactive”. Hotspot showed 149.8MiB and OpenJ9 59.77MiB.

How to Run the Tests

I’ve used my sample application, which is part of the cloud-native-starter project. The microservice provides REST APIs, which perform CRUD operations on a PostgreSQL database.

To run the microservice with OpenJ9 in Minikube, invoke the following commands.


I’ve used the following Dockerfile:


In order to use Hotspot, replace the Dockerfile with the content from Dockerfile.Hotspot and run the same commands.


Further Reading

Quarkus Refcard

Developing Serverless Applications With Quarkus

microservices ,java ,cloud ,quarkus ,tutorial ,openj9 ,openjdk

Published at DZone with permission of Niklas Heidloff , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}