Alina Yurenko
Aug 20 · 5 min read

Today we are excited to release GraalVM 19.2!

This is the next major release after 19.1, bringing improved profile-guided optimizations, an included LLVM toolchain, enhanced VisualVM with Java Flight Recorder support, a preview of a new Visual Studio Code plugin, better native image peak performance, and much more. For a more complete list of the noteworthy changes, please check the release notes.

We would like to thank the community for the great feedback and reported issues, as well as the contributors whose pull requests have been merged into this release!

Keep reading to learn more about featured updates and our version roadmap, or just download and try it right away!

Profile-Guided Optimizations

The GraalVM just-in-time (JIT) mode running on the JVM is well suited for high peak performance due to its capability to collect runtime information during startup and use it to optimize machine code. GraalVM ahead-of-time (AOT) mode excels at startup time and memory consumption but provides lower peak performance due to the missing runtime information. To mitigate this, the GraalVM team implemented profile-guided optimizations (PGO) for GraalVM Enterprise Edition. With PGO, you can collect the profiling data in advance and then feed it to the GraalVM native-image utility, which will use this information to optimize the performance of the resulting binary.

Up until GraalVM 19.2, to apply PGO you needed to build an instrumented native image binary first and run it to collect profiles. Now, you can collect profiles while running your application in JIT mode and then use this information to generate highly-optimized native binaries.

How to enable PGO

1. run your java program in JIT mode with a -Dgraal.PGOInstrument flag to gather profiling information:
$ /graal-ee-19.2.0/bin/java -Dgraal.PGOInstrument=myclass.iprof MyClass

2. use collected data to generate a native image:
$ /graal-ee-19.2.0/bin/native-image --pgo=myclass.iprof MyClass

3. your image is ready for use with fast startup and high throughput:
$ ./myclass

Java Flight Recorder

Java Flight Recorder (JFR) is a tool for collecting diagnostic and profiling data about a running Java application. It collects data about events, that occur in the JVM or Java application at a specific point in time.

Java Flight Recorder in Graal VisualVM

The VisualVM tool bundled with GraalVM now includes preview support for visualizing the data of Java Flight Recorder files.

To enable JFR support, first run $GRAALVM_HOME/bin/jvisualvm to start VisualVM. Use Tools | Plugins | Available Plugins to list all available plugins and install the VisualVM-JFR and VisualVM-JFR-Generic modules. The JFR snapshots can be opened using either the File | Load… action or by double-clicking the JFR Snapshots node and adding the snapshot into the JFR repository permanently. Please follow the documentation for your Java version to create JFR snapshots.

JFR support is currently a preview feature. You can leave your feedback or file a RFE/bug at github.com/oracle/visualvm/issues.

Performance Improvements

There have been minor performance enhancements in all configurations. One major update is the improved default throughput for native images in GraalVM Enterprise Edition. We measured results when running the Micronaut GraalVM example without any profile-guided optimizations. For 1 million requests, we are spending ~10% less CPU time and achieve a ~10% higher throughput of requests per CPU second in 19.2. The throughput is still lower than in the just-in-time (JIT) configuration of GraalVM, but we continue to make progress towards bringing the AOT configuration to the same levels.

LLVM Toolchain

The GraalVM distribution includes an LLVM bitcode engine, which can execute C/C++ and other languages that can be compiled to LLVM bitcode. Although compiling C/C++ to bitcode is possible to do with the standard LLVM tools (clang, llvm-link, etc.), it can be tricky especially if linking and build systems such as make enter the game. The toolchain aims to simplify this process, by providing an out-of-the-box drop-in replacement for the compiler when building native projects targeting the GraalVM LLVM runtime.

How to get started

To get started, download GraalVM 19.2 and add LLVM toolchain via the following command (the same goes for Community Edition and GraalVM Enterprise):

gu install llvm-toolchain

Now, to run a sample “Hello World!” C++ program via the toolchain, do the following:

$ $GRAALVM_HOME/jre/languages/llvm/native/bin/clang++ hello-c++.cpp -o hello
$ $GRAALVM_HOME/bin/lli hello

You can learn more about LLVM toolchain in the reference manual.

Please note that the toolchain is experimental — functionality may be added, changed or removed.

GraalVM Extension for Visual Studio Code

We released a first experimental VS Code extension, providing basic support for editing and debugging programs running on GraalVM.

You can use the following debug configurations:

  • Launch Node.js Application
  • Launch JavaScript: launches a JavaScript using GraalVM in a debug mode.
  • Attach: attaches debugger to a locally running GraalVM.
  • Attach to Remote: attaches debugger to the debug port of a remote GraalVM.

For JavaScript sources opened in the editor, all Polyglot.eval(...) calls are detected and the respective embedded languages are injected to their locations.

We are planning to continue working on this project and would highly appreciate feedback and suggestions.

Version Roadmap

We created a description of our version roadmap with predictable release dates and information on update releases. Find below an illustration of the release tree and read more at our website here. We will in the future also introduce a more traceable process for which features are planned for the next major releases.


Download GraalVM 19.2 to try the new features: www.graalvm.org/downloads.

We highly appreciate your feedback — please leave an issue at the GraalVM GitHub repo or contact us in any other way!

graalvm

GraalVM team blog - https://www.graalvm.org

Thanks to Oleg Šelajev

Alina Yurenko

Written by

I love all things tech & community. Developer Advocate for @graalvm , new universal polyglot VM 🚀

graalvm

graalvm

GraalVM team blog - https://www.graalvm.org

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade