5 Reasons Why You Should Consider Switching to Eclipse OpenJ9

Often when the Java Virtual Machine is discussed in a presentation or article, it is described in very monolithic terms, i.e. “the JVM”. This can give the mistaken impression that there is only single JVM implementation to choose from. In reality though there are actually several JVM implementations to choose from. Knowledge that there are multiple JVMs available is becoming more common with the highly publicized GraalVM and Amazon’s Coretto. There is however another JVM option that has been around for some time, Eclipse OpenJ9.

Eclipse OpenJ9 is an open source JVM implementation that IBM supports. OpenJ9 was open sourced from IBM’s J9 JVM back in 2017 and is available for download from adoptopenjdk.net. In this article we will look at five reasons why you should consider switching to OpenJ9 for running your Java workloads in production.

#1 Significant Reduction in Memory Usage

openj9-memory-copnsumption

The biggest and most straight forward advantage OpenJ9 offers is it uses dramatically less memory when compared to the other publicly available JVMs. The above is a screenshot of a Grafana dashboard from a demo I put together comparing the performance of OpenJ9 to OpenJDK Hotspot, Amazon Corretto, and GraalVM. The demo, executing a simple Spring Boot Batch application, isn’t a specialized use case that plays to OpenJ9’s strengths, but very much in line with the roughly 40% drop in memory consumption the IBM Runtimes team has seen when testing OpenJ9 as well as what users have reported back.

OpenJ9’s is able accomplish this dramatic reduction in memory usage because of its heritage as a JVM designed to run on smartphones in the early 2000’s. Running applications in a mobile environment demands being more conscious of resource usage as; memory, CPU, battery life, were particularly scarce on mobile devices of that era. This legacy of resource conservation lives on in OpenJ9 and while there is no shortage of resources in a cloud environment, there is a price tag attached to using it. A JVM that uses less resources could mean organizations spending less a month on hosting their Java applications on cloud platforms.

#2 Class Sharing

One of my favorite features of OpenJ9 is the ability to do class sharing. Class sharing is a feature that is key for the cloud native world where new instances of an application will be started up and shut down as demand changes or a new and better version is made available.

In a world where applications are being frequently started up, the time it takes until an application is available to start servicing requests and the time it takes until it reaches peak performance (ramp up) becomes more of a concern. Start up can be a resource intensive time for an application as well as the JVM compiles code and performs optimizations.

A lot of the actions performed by the JVM during the start up and ramp up phases will be the same every time. As developers we are taught we should try to reuse code where possible and the lesson of reuse would apply here as well. Class sharing works by allowing a JVM to write to a common location; compiled code and optimizations, that can then be used by other JVMs. Two great design choices in how this feature is implemented are there isn’t neither a leader/follower concept nor will a JVM require a shared cache to be present. This removes points of failure where a JVM unexpectedly stopping or a shared cache being deleted, will not cause other JVMs to crash or fail at startup.

Class sharing can reduce CPU utilization, as compilations and optimizations are CPU intensive, as well as the aforementioned improved performance around startup and ramp up. For more information on class sharing check out this article. If you are interested in using class sharing in a (Docker) containerized environment, check out this article I wrote that looks at a couple of strategies on how to implement class sharing in a containerized environment.

#3 OpenJ9 is Free to Use

OpenJ9 is licensed under the Eclipse Public License 2.0 and Apache License 2.0 licenses, which means you can run your Java workloads in production on OpenJ9 without paying a penny in licensing costs. With the shockwaves and confusion still reverberating around the Java world from Oracle’s recent changes to how it licenses the commercial OracleJDK, having options for running Java where you can have total confidence that you don’t have a potential lawsuit looming in the future over unpaid licensing costs can be very comforting.

For more information on OpenJ9’s license, you can view it here under OpenJ9’s Github repository.

#4 Commercial Support is Available

Free to use is great if you are a start up and running on a limited budget or in the proof of concept phase (such as proving the concept of using OpenJ9 😉). However if your organization’s assets values in the millions, billions, or even trillions, saving thousands a month in licensing cost doesn’t make much sense if you are giving up the peace of mind that commercial support offers.  To that end IBM offers commercial support for OpenJ9. You can read more about the support IBM provides and support cost here.

#5 Switching is Really Easy

So what does it take to switch to OpenJ9?

Refactoring your code to use OpenJ9 concepts?

Recompiling and redeploying all your Java applications to run in an OpenJ9 environment?

The answer is neither. Java is actually an API that is defined by the Java Language Specification (JLS). OpenJ9 is built to be compatible with the Java API as specified in the JLS, here is the JLS for Java 12, and so is capable of running any Java code without any special requirements. The demo I referenced in my first point is actually running the exact same Java artifact in all the containers. If compatibility with running Java artifacts wasn’t enough, OpenJ9 even offers migration support for Hotspot JVM arguments.

But if this is enough for you, check out these testimonials from real users of OpenJ9:

openj9-testimonial.png

Conclusion

As a developer my experience and interactions with JVMs has mostly been limited to executing java -jar . From my perspective the JVM was just something to run my Java applications, I didn’t really care how. I became immediately interested by OpenJ9 however because it had such readily apparent and accessible advantages over other JVMs. This article only scratches the surface of what OpenJ9 has to offer and our IBM Runtimes team is hard at work on improving and adding new features to OpenJ9.

If you would like to know more about OpenJ9 be sure to check out the very helpful user docs: https://www.eclipse.org/openj9/docs/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s