- Why Graalvm
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 #
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 #
Reuse Libraries from Java, R, or Python #
Run with Large Heaps #
Define Data Structures in C/C++ #
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.
Running in Oracle Database #
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.