Without JavaScript and LLVM
The GraalVM JDK has a modular structure in the new release and only comes with the JDK runtime in the basic distribution. As before, the runtime environments for JavaScript and LLVM are available separately as extensions for Python or Ruby and can be used with gu install js
respectively gu install llvm
reinstall.
The VisualVM heap analysis tool also now requires a separate installation. Due to the modularization, the base GraalJDK in version 22.2 is a good 40 percent smaller than in GraalVM 22.1. Anyone who only uses the virtual machine for Java applications on the JVM or uses native images does not have to make any adjustments.
More efficient builds
GraalVM provides native images compiled with an AOT (Ahead-of Time) compiler as an alternative to translating bytecode at runtime via the JIT (Just-in Time) compiler. Native images are independently executable files that contain the classes of the runtime library and the dependencies as well as native code of the JDK in addition to the translated classes of the actual application. As an advantage, they bring better start times and a lower memory requirement.
Versions 21.3 and 22.0 had optimizations for slimmer images on board, and the 22.1 release brought with it a Quick Build mode that accelerated the creation of images in the development process. GraalVM 22.2 now optimizes memory usage during the build process. The adjustments are particularly useful for teams that build their applications in cloud services or via GitHub actions. Even larger executables should get by with 2 GB of memory. As a reference application, Oracle lists the Spring sample application PetClinic, which already served as a benchmark for the quick build mode for the previous version.
Central metadata repository
Another innovation is also aimed at native images. By default, GraalVM only compiles the parts of an application that are reachable from the central entry point. This can cause problems when elements are missing from the executable but are needed for reflection or serialization. To include these items manually requires metadata with configuration information. It is not only important to include your own application, but also external libraries.
The current release introduces a central GraalVM Reachibility Metadata Repository available as a separate open source project on GitHub. In the repository, developers of libraries or frameworks can provide the metadata for their native images. Those who use the external libraries can use the information from the repository. For a Gradle project, the following lines enable access:
graalvmNative {
metadataRepository {
enabled = true
}
}
Heap dumps and SOM for native images
In version 22.2, the open source variant GraalVM Community introduces heap dumps for native executables, which can be analyzed with tools such as VisualVM. The new command line parameter -XX:+DumpHeapAndExit
Dumps the initial heap at startup using a native image.
The Enterprise version of GraalVM can now include information about the Software Bill of Materials (SBOM) in native images. SBOMs list all the ingredients of a software project. In addition to the direct source code, this includes internal and external dependencies. Currently GraalVM can handle CycloneDX format.
Further innovations such as the lower memory requirements of the JIT compiler (Just in Time) can be found in the official announcement. The GraalVM is available both as an Enterprise variant and in a Community Edition. The source code for the latter can be found in the GitHub repository, and binaries can be downloaded from the GraalVM page.