Connect with us

Tech News

Virtual machine GraalVM 22.2 performs double slimming

Published

on

virtual machine graalvm 222 performs double slimming.jpg

The modular GraalVM JDK basically does without separate runtimes, and the virtual machine requires less memory for the build of native images.

Oracle has released GraalVM 22.2 on a quarterly basis. The current release brings a modular JDK distribution that is a good 40 percent leaner than the full environment. Oracle has optimized the build process for native images, which now uses less memory. There is also a central repository with metadata for native images.

 

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.

 

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.

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
  }
}

 

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.

Copyright © 2017 Zox News Theme. Theme by MVP Themes, powered by WordPress.