GraalVM is a high-performance runtime that can accelerate applications written in Java and other JVM languages. It includes a new just-in-time (JIT) compiler called Graal that can compile code ahead-of-time into a standalone native image executable. This ahead-of-time compilation allows applications to start faster and use less memory compared to the traditional HotSpot JVM. GraalVM is best suited for applications that benefit from fast startup times and a small memory footprint like command-line tools, containerized services, and embedded systems.
3. GRAALVM
A high-performance multilingual runtime. It is
designed to accelerate the execution of applications
written in Java and other JVM languages while also
providing runtimes for JavaScript, Ruby, Python, and
a number of other popular languages.
Know more at https://www.graalvm.org/
4. HotSpot VM vs GraalVM
• Graal is part of JDK from OpenJDK 9+ .
• Graal is the new JIT (Just in time)
compiler which will replace C2.
• Graal distinguishes between image
build time and image run time. At
image build time, a static analysis finds
all methods that are reachable from
the entry point of the application and
these methods are then ahead-of-
time compiled into a native image.
5. JIT vs AOT
Just-in-time Compiler Ahead-of-time Compiler
Compiles while running Compiles before running
Dynamic compilation Static compilation
Runtime information More resources
De-optimization Way more time
Typical for JVM Uncommon for JVM (JDK
9+)
7. NATIVE
RUNTIME
• Substrate VM is an internal project name for the
technology behind GraalVM Native Image.
• Native Image is a technology to ahead-of-time compile
Java code to a standalone executable, called a native
image.
• GraalVM is a hybrid of static and dynamic runtimes.
8. GRAAL COMPILER DEMO
This demo example counts the number of uppercase characters in a body of text.
To simulate a large load, the same sentence is processed 10 million times:
10. WHY GRAALVM?
• Fast start-up Java Application:
Native
• Low footprint ahead-of-time
mode for JVM-based languages
• High performance for all
languages
• Convenient language
interoperability and polyglot
tooling
• Java as Language Platform
• Embedded Java Application
11. WHY NOT… ?
• No Dynamic class Loading / Unloading
• No JVMTI, Java Agents, JMX, JFR support
• Efficient only for smaller heap [Due to
serial GC]
• No thread dump and heap dump
support
• Opaqueness with reflection
• Generated native code is not fully
efficient while using profiling [Due to no
access for application runtime profile]
12. USECASES
SUBSTRATEVM
• Command-line tools
• Embedded / Constrained
devices (note: ARM is not supported
for SVM yet)
• Containerized environments where
raw performance is not the main
concern
JVM + GRAAL JIT COMPILER
• Services, Networked services, Micro-
services,
• Data processing applications where
performance is critical
• Alternative JVM languages