GraalVM offers a comprehensive ecosystem supporting a large set of languages (Java and other JVM-based languages, JavaScript, Ruby, Python, R, and C/C++ and other LLVM-based languages) and running them in different deployment scenarios (OpenJDK, Node.js, Oracle Database, or standalone). This page provides an overview of different scenarios in which GraalVM can make a difference for your applications.Some of versatile GraalVM capabilities, that might be missing on this page are thoroughly summarized and disclosed in Top 10 Things To Do With GraalVM blog post.

For Java Programs

For existing Java applications, GraalVM can provide benefits by running them faster, providing extensibility via scripting languages, or creating ahead-of-time compiled native images.

Run Java Faster

GraalVM can run in the context of OpenJDK to make Java applications run faster with a new just-in-time compilation technology. GraalVM takes over the compilation of Java bytecode to machine code. In particular for other JVM-based languages such as Scala, this configuration can achieve benefits, as for example experienced by Twitter running GraalVM in production.

The compiler of GraalVM provides performance advantages for highly abstracted programs due to its ability to remove costly object allocations in many scenarios. You can find details in this research paper and try an example. Better inlining and more aggressive speculative optimizations can lead to additional benefits for complex long-running applications, see a Stream API example.

Whether and how much of a difference GraalVM makes in terms of performance depends of course on the concrete workload. We are interested in receiving any kind of benchmarking results that can help us make GraalVM even faster.

Make Your Application Extensible

GraalVM enables running JavaScript, R, Python, or Ruby in the context of Java applications. It offers the ability to expose Java data structures to those languages and offers secure managed mechanisms (e.g., time boxing or memory boxing). The integration is language-agnostic, i.e., an integration for JavaScript can at the later point be also used to execute any other GraalVM-based language. Proxy mechanisms allow mocking up dynamic objects from Java data structures and expose them to the embedded scripts. Take a look at the description on how to make your JVM-based application extensible with GraalVM.

Create a Native Image

Running your application inside a Java VM comes with startup and footprint costs. GraalVM has a feature to create native images for existing JVM-based applications. The image generation process employs static analysis to find any code reachable from the main Java method and then performs full ahead-of-time (AOT) compilation. The resulting native binary contains the whole program in machine code form for its immediate execution. It can be linked with other native programs and can optionally include the GraalVM compiler for complementary just-in-time (JIT) compilation support to run any GraalVM-based language with high performance. For additional performance, native images can be built with profile guided optimizations gathered in a previous run of the application. See an example of how to build native images here.

For Node.js Programs

GraalVM can run in the context of Node.js by replacing V8 with GraalVM for executing JavaScript. The main benefits of doing so is to enable polyglot applications (e.g., use Java, R, or Python libraries), run Node.js with large heap configurations and Java’s garbage collectors, or use GraalVM’s interoperability to define data structures in C/C++ and use them from JavaScript.

Reuse Libraries from Java, R, or Python

GraalVM enables the use of existing Java libraries or Java frameworks (like Spark or Flink) directly from Node.js. Also, one can use for example R or Python for data science or plotting directly from a JavaScript application. Find an example of a polyglot application here.

Run with Large Heaps

The V8 JavaScript engine included in the standard Node.js distribution is tuned for browser configurations and designed to work effectively in small heap scenarios. We enable running Node.js with the heap management of the JVM, opening the ability for large heap configurations and suitable garbage collection settings. The maximum configurable heap size is 32 Gb with compressed 32-bit pointers, and terabytes of heap are supported in the 64-bit pointer configuration.

Define Data Structures in C/C++

GraalVM allows efficient combination of native code (e.g., written in C/C++) and JavaScript. Native data structures can be directly accessed and the compiler can inline across any boundary. This can be beneficial in a scenario where efficient data structures are managed and allocated in C while other parts of the application are written in Node.js. Find an example of such scenario in the reference manual.

For Ruby, R, or Python

Warning: Support for Ruby, R, or Python is experimental in GraalVM.

We are actively working on stability and support for all modules for those languages. At this point in time, we can run simpler applications of Ruby and R, but we do not have the same full compatibility we provide for Java and Node.js applications. Our Python implementation was just recently started and can only run small examples.

Apart from the standard GraalVM benefits such as language interoperability (e.g., use Java or JavaScript from those applications), GraalVM can achieve high speedups of 10x or more for those languages. We are happy to assist with making existing Ruby and R applications work with GraalVM, but we cannot guarantee out-of-the-box compatibility for these languages yet.

Running in Oracle Database

GraalVM is designed for embeddability and can be executed in databases. Ourprototype of the Oracle Database Multilingual Engine (MLE) is availablehere. It allows Oracle Database usersto run JavaScript, using browserify to execute Node.js modules, and to writeextensions in Python.

For Microservices Frameworks

GraalVM Native Image, currently available as an Early Adopter technology, works with many different Java microservices frameworks.Several projects have already accepted this technology as a platform for theirapplications: Quarkus, Micronaut, Helidon. For these frameworks GraalVM nativeimages significantly reduce the runtime memory requirements compared to runningon HotSpot. We believe that GraalVM Native Image technology can become the bestway for deploying cloud native applications.

microservices

microservices

For Your Platform

We encourage the development of GraalVM embeddings similar to our ownintegrations in the Oracle Database, OpenJDK, or Node.js. Together with researchcollaboration partners, we already explored ideas of embedding in Spark orFlink. Find a description on how to embed GraalVM in your existing JVM-basedapplication or native application here.

For Your Languages and Tools

GraalVM is an open ecosystem and we invite third party systems to participatevia connecting their own programming languages, tools, or platforms.

Implement Your Own Language

The Truffle Language Implementation framework allows running programming languages efficiently on GraalVM. It simplifies language implementation by automatically deriving high-performance code from interpreters. You can find details about the approach in this research paper.

Implementing your own language using GraalVM will not only give you high performance. More importantly, it allows your language to connect with the rich tooling provided by the GraalVM ecosystem. Also, it enables your language to run in the context of any GraalVM embedding.

We developed a demonstration language called “SimpleLanguage” to show the use of GraalVM’s language implementation framework. Find out how to get started implementing a language.

Create Language-agnostic Tools

GraalVM provides a framework for creating language-agnostic tools like debuggers, profilers, or other instrumentations. GraalVM provides a standardized way to express and run program code enabling cross-language research and the development of tools that are developed once and then can be applied to any language.