Introduction to GraalVM

Photo by Grégoire Bertaud on Unsplash

Where does the name “GraalVM” come from?

Current Situation

  • Hotspot VM also contains just-in-time (JIT) compilers.
  • JIT compilers compile your application code to machine code on the go, as your program executes.
  • If your code gets frequently executed (warms up), it gets compiled to machine code by the C1 (Client Compiler) JIT compiler.
  • If it is still executed often enough, reaching certain thresholds, it is compiled by the top-tier JIT compiler (C2 (Server Compiler) or the Graal compiler).
  • As well as “profiling information” based optimizations, sometimes the compiler performs “speculative optimizations”.
  • The assumptions can become invalid at a later time (since code execution is dynamic).
  • The optimized, compiled version of a method based on the profiling information can be reverted back to interpreted mode.


  • A high performance optimizing JIT compiler (C2 or the Graal compiler, to accelerate performance of any Java and JVM-based application without the need for code changes)
  • An ahead-of-time (AOT) compiler to build native executables (to compile JVM-based applications to natively executable binaries) — This AOT capability is called a Native Image (the AOT Compiler is introduced in Java 9).
  • Support for multiple languages (makes it possible to run JavaScript, Ruby, Python, and a number of other popular languages on the JVM)
  • Its package manager, called gu, lets users install other languages.
  • There are two editions: Community and Enterprise Edition
Just In Time Compilation —

GraalVM Native Image

  • Compiles Java code ahead-of-time into a native executable file.
  • Only the code that is required at run time by the application (a fraction of the resources required by the JVM) is included in the executable file.
  • While the AOT compiler compiles Java code into a native executable, it will analyze its dependencies, dependent JDK libraries and VM components and removes all unused classes, method, and fields from your application and libraries.
  • This process makes reverse engineering difficult by converting Java bytecode into native machine code. Potential attack surfaces are also minimized.
  • Supported by many microservice frameworks: Micronaut, Spring, Helidon, Quarkus, etc.
  • Maven and Gradle plugins for Native Image so you can easily build, test (there is also JUnit testing support), and run Java applications as executable files.
Performance Comparison —
Native Image at Scale — Startup Time —




I would love to change the world, but they won’t give me the source code | coding 👩🏼‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Top Document Management Solution Companies

Jupyter + IDE: how to make it work.

Rotate an Array

Swift | Create Generic UIView

How to run over 30k tests in under 5 minutes

Moving Perl Mojolicious routes to their own module

Integrating Your Android App with OpenCV Library

Week 3 Reflection: Halfway Through

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nil Seri

Nil Seri

I would love to change the world, but they won’t give me the source code | coding 👩🏼‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨

More from Medium

Java NIO: Using Memory-mapped file to load big data into applications

Generics in Java

Aspect object programming with Spring boot (Part One)

Spring RestTemplate vs GraphQL Client