Kit Wai Chan - Fotolia

Oracle's GraalVM finds its place in Java app ecosystem

Oracle's GraalVM, a universal virtual machine that runs apps written in Java and other languages, has carved out a spot in the Java ecosystem.

One year after its initial release for production use, Oracle's GraalVM universal virtual machine has found validation in the market, evidenced by industry-driven integrations with cloud-native development projects such as Quarkus, Micronaut, Helidon and Spring Boot.

GraalVM supports applications written in Java, JavaScript and other programming languages and execution modes. But it means different things to different people, said Bradley Shimmin, an analyst with Omdia in Longmeadow, Mass.

First, it's a runtime that can support a wide array of non-Java languages such as JavaScript, Ruby, Python, R, WebAssembly and C/C++, he said. And it can do the same for Java Virtual Machine (JVM) languages as well, namely Java, Scala and Kotlin.

Secondly, GraalVM is a native code generator capable of doing things like ahead-of-time compiling -- the act of compiling a higher-level programming language such as C or C++ into a native machine code so that the resulting binary file can execute natively.

"GraalVM is really quite a flexible ecosystem of capabilities," Shimmin said. "For example, it can run on its own or be embedded as a part of the OpenJDK. In short, it allows Java developers to tackle some specific problems such as the need for fast app startup times, and it allows non-Java developers to enjoy some of the benefits of a JVM such as portability."

GraalVM came out of Oracle Labs, which used to be Sun Labs. "Basically, it is the answer to the question, 'What would it look like if we could write the Java native compiler in Java itself?'" said Cameron Purdy, former senior vice president of development at Oracle and current CEO of Xqiz.it, a stealth startup in Lexington, Mass., that is working to deliver a platform for building cloud-native applications.

"The hypothesis behind the Graal implementation is that a compiler built in Java would be more easily maintained over time, and eventually would be compiling itself or 'bootstrapped' in compiler parlance," Purdy added.

The GraalVM project's overall mission was to build a universal virtual machine that can run any programming language.

The big idea was that a compiler didn't have to have built-in knowledge of the semantics of any of the supported languages. The common belief of VM architects had been that a language VM needed to understand those semantics in order to achieve optimal performance.

"GraalVM has disproved this notion by demonstrating that a multilingual VM with competitive performance is possible and that the best way to do it isn't through a language-specific bytecode like Java or Microsoft CLR [Common Language Runtime]," said Eric Sedlar, vice president and technical director of Oracle Labs.

To achieve this, the team developed a new high-performance optimizing compiler and a language implementation framework that makes it possible to add new languages to the platform quickly, Sedlar said. The GraalVM compiler provides significant performance improvements for Java applications without any code changes, according to Sedlar. Embeddability is another goal. For example, GraalVM can be plugged into system components such as a database.

GraalVM joins broader ecosystem

One of the higher-profile integrations for GraalVM is with Red Hat's Quarkus, a web application framework with related extensions for Java applications. In essence, Quarkus tailors applications for Oracle's GraalVM and HotSpot compiler, which means that applications written in it can benefit from using GraalVM native image technology to achieve near instantaneous startup and significantly lower memory consumption compared to what one can expect from a typical Java application at runtime.

"GraalVM is interesting to me as it potentially speeds up Java execution and reduces the footprint – both of which are useful for modern Java applications running on the cloud or at the edge," said Jeffrey Hammond, an analyst at Forrester Research. "In particular, I'm watching the combination of Graal and Quarkus as together they look really fast and really small -- just the kind of thing needed for microservices on Java running in a FaaS environment."

In particular, I'm watching the combination of Graal and Quarkus as together they look really fast and really small -- just the kind of thing needed for microservices on Java running in a FaaS environment.
Jeffrey HammondAnalyst, Forrester
Jeffrey HammondJeffrey Hammond

Quarkus uses the open source, upstream GraalVM project and not the commercial products -- Oracle GraalVM or Oracle GraalVM Enterprise Edition.

"Quarkus applications can either be run efficiently in JVM mode or compiled and optimized further to run in Native mode, ensuring developers have the best runtime environment for their particular application," said Rich Sharples, senior director of product management at Red Hat.

Red Hat officials believe Quarkus will be an important technology for two of its most important constituents -- developers who are choosing Kubernetes and OpenShift as their strategic application development and production platform and enterprise developers with deep roots in Java.

"That intersection is pretty huge and growing and represents a key target market for Red Hat and IBM," Sharples said. "It represents organizations across all industries who are building out the next generation of business-critical applications that will provide those organizations with a competitive advantage."

Dig Deeper on Core Java APIs and programming techniques