GraalVM is a high-performance runtime that provides significant improvements in application performance and efficiency which is ideal for microservices. It is designed for applications written in Java, JavaScript, LLVM-based languages such as C and C++, and other dynamic languages. It removes the isolation between programming languages and enables interoperability in a shared runtime. It can run either standalone or in the context of OpenJDK, Node.js or Oracle Database.

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. 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, Ruby, LLVM IR and Web Assembly in the context of Java applications. It offers the ability to expose Java data structures to those languages with fine-grained host access filters. 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, Python or WebAssembly #

Ruby, R, Python, WebAssembly are experimental in the GraalVM ecosystem and not recommended for production use at this time, but 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, R, and Python but we do not have the same full compatibility we provide for Java and Node.js applications. WebAssembly currently implements the WebAssembly MVP (Minimum Viable Product) specification and is the youngest language in the GraalVM environment.

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. Our prototype of the Oracle Database Multilingual Engine (MLE) is available here. It allows Oracle Database users to run JavaScript, using browserify to execute Node.js modules, and to write extensions 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 their applications: Quarkus, Micronaut, Helidon. Also, the Spring Native project provides beta support for compiling Spring applications to native executables using GraalVM Native Image. For these frameworks GraalVM native images significantly reduce the runtime memory requirements compared to running on HotSpot. We believe that GraalVM Native Image technology can become the best way for deploying cloud native applications.



For Your Platform #

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

For Your Languages and Tools #

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

Implement Your Own Language #

The Truffle language implementation framework (Truffle), 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 Truffle features. 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.

Connect with us