5

GraalVM 22.3 is here: JDK 19 builds, jlink support, new monitoring features, and...

 1 year ago
source link: https://medium.com/graalvm/graalvm-22-3-is-here-jdk-19-builds-jlink-support-new-monitoring-features-and-more-f6e2b2eeff95
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

GraalVM 22.3 is here: JDK 19 builds, jlink support, new monitoring features, and more!

1*lYOUwJr8Ua4sCEB0jaMbLg.png

Today we’re releasing GraalVM 22.3!

This release brings JDK 19 builds, jlink support, new monitoring features, new Native Image APIs, and more!

As the last feature release of 2022, GraalVM Community 22.3 will receive updates for the next 12 months — so if you were considering upgrading your GraalVM version, now is a great time to do so!

As always, you can download GraalVM Community from GitHub, or get the GraalVM Enterprise builds from OTN. For a detailed list of updates, check out the release notes.

GraalVM JIT and Native Image will become a part of OpenJDK

Before we talk about 22.3, we want to mention an important recent update. At JavaOne we announced that GraalVM CE Java code will become part of OpenJDK. This change will apply to the CE parts of the Graal compiler and Native Image. We are excited about this change and the impact it will have on the GraalVM community and the broader Java ecosystem.

This means that we will adopt the same methodologies and approach used by the OpenJDK community: including having Committer and Reviewer roles as well as JEPs. We will also align our release models, meaning that after the announced change takes place, GraalVM will have Critical Patch Update releases every quarter, feature releases every six months, and an LTS release every two years.

For the full announcement and more details, go to the GraalVM website.

Now, let’s take a look at what’s new in this release!

You can also watch our live stream recording, where we talk about the new features and take them for a spin:

GraalVM JDK 19 builds

You may have already tried GraalVM JDK 19 builds with our developer builds; now you can also use regular GraalVM builds of JDK 19! GraalVM 22.3 is released for JDK 11, 17, and 19, but we are planning to retire JDK 11 support in GraalVM 23.0. GraalVM JDK 11 builds will continue to be updated throughout 2023 within 22.3.X, so you can stay on GraalVM JDK 11, but we recommend that you migrate to JDK 17+ for access to the Java preview features.

And there’re good reasons to migrate — for example, GraalVM JDK 19 includes all GraalVM components such as the compiler, Native Image, and GraalVM languages (except for Java on Truffle), along with support for the latest Java features that we all know and love, such as virtual threads from project Loom. Take virtual threads on GraalVM for a spin with our Game of life Native demo (make sure to unlock Loom with the --enable-preview option in your build file or the command line), which demonstrates running a highly concurrent, computationally intensive application as a native executable produced by GraalVM Native Image: https://github.com/graalvm/game-of-life-native.

1*SMq-n_o5jW5WFqT185OCAg.gif

“Game of life” performance in AOT and JIT modes.

Bear in mind that this release of GraalVM JDK 19 is experimental; we are planning to support JDK 19 in GraalVM 23.0. Also, virtual threads aren’t yet supported for GraalVM languages when runtime compilation is enabled.

One-line GraalVM JDK Downloads

In addition to downloading GraalVM from GitHub, from Oracle Technology Network, via our GitHub action, using our VS Code extension, or through SDKMan, you can now use a convenient one-line command to download! You can use the command for both local development and build pipelines. For a quick start, run the following command. By default it will download the latest GraalVM release with the latest supported JDK version, including Native Image!

bash <(curl -sL https://get.graalvm.org/jdk)

For more details and customizations, check out our related blog post.

Simple Webserver as a Native Image

As of Java 18, you can use the jwebserver tool, a minimal HTTP server for prototyping, testing, and debugging. GraalVM JDK 19 now allows you do to just that, and even better — you can compile jwebserver into a native application! All you have to do is run the following command: $JAVA_HOME/bin/native-image -m jdk.httpserver -o jwebserver

1*OpQh39Tckrqk1AljBKofJg.png

jwebserver running as a native executable produced by GraalVM Native Image.

Native Image monitoring and developer experience updates

As with every release, we worked to extend monitoring features in Native Image:

  • We added the --enable-monitoring=<all,heapdump,jfr,jvmstat> option, which gives you fine-grained control over the monitoring features included in your executables. It replaces the -H:±AllowVMInspection option, which should no longer be used.
  • We also added support for jvmstat in Native Image. With jvmstat, you can, for example, monitor the performance and resource consumption of your native executables at run time. You can also easily capture heap dumps with VisualVM.
  • Together with the community, we keep building out the JFR support in Native Image. 22.3 brings support for the JavaMonitorEnter, JavaMonitorWait, and ThreadSleep events. Thanks to Red Hat for this contribution!
  • We also improved the debugging experience so it’s easier to identify memory usage and memory leaks. For example, perf report is able to associate code addresses sampled during a perf record session with Java methods and print the DWARF-derived method name for the method in its output histogram. This is another contribution from Red Hat.
  • To embed software bill of materials (SBOM) in your application, please use the new API option --enable-sbom.
  • We also reduced the file size of the GraalVM Native Image installable from ~120 MB to ~30 MB. Please note that the LLVM backend is now shipped as an optional native-image-llvm-backend component.

GraalVM Native Build Tools and Reachability Metadata

We released Native Build Tools 0.9.15 — please upgrade if you haven’t already. Since 22.2 we also released a few versions of GraalVM Reachability Metadata, including new and updated metadata for Hibernate, Jetty, Thymeleaf, JAXB, and other libraries.

Get started with GraalVM Reachability Metadata here.

New Native Image API

For library and framework authors that want to take full advantage of Native Image, we’ve added new public APIs for programmatic registration of JNI, Resource, Proxy, and Serialization classes from Feature interface classes. We also moved annotations for method substitutions to the Graal SDK. For this release, the org.graalvm.nativeimage:svm artifact (that was used to gain access to native-image internals) continues to be published on Maven Central, but we are planning to retire it, so please migrate to using the Graal SDK instead and report any missing APIs or features to us.

Compiler Updates

  • With GraalVM JDK 19 builds, you can use the latest Java features, such as virtual threads, the simple web server, and structured concurrency, on GraalVM.
  • The Graal compiler is now using one isolate per libgraal compiler thread. This policy leads to better isolation per compilation and less garbage collection (GC) for the compiler, which significantly improves compilation throughput and memory footprint. On the DaCapo benchmarks, compilation as measured in bytecodes-per-second at least doubled, with individual benchmarks such as fop and pmd showing a 3x increase in speed. This policy is enabled by default; to disable it, use the following options: -XX:JVMCINativeLibraryThreadFraction=0.66 -XX:JVMCIThreadsPerNativeLibraryRuntime=0.
  • We also added a dedicated Native Image GC policy for the Graal compiler that adjusts Eden space aggressively to minimize RSS memory usage. This policy is also enabled by default.
  • jlink now produces images that use the Graal compiler as the top-tier compiler; when running the java --version command, you’ll also see GraalVM shown as your JDK.
  • We also implemented loop vectorization for integer min/max operations, which should make such operations faster. This implementation handles all integer sizes, hand-written min/max patterns (for example, x > y ? x : y, not just Math.min/Math.max), unsigned min/max, and fold-shaped loops (for example, computing the minimum or maximum element of an array). For example, computing the minimum of an int array:
int min = Integer.MAX_VALUE;
for (int x : someArray) {
min = Math.min(min, x);
}

is now about 8x faster. This optimization is also enabled by default.

  • The StripMineCountedLoops and EarlyGVN compiler optimizations, introduced in 22.2 as experimental, are now enabled by default.

Meet GraalPy!

GraalPython is now GraalPy!🐍🎉 We renamed the project and the launcher: graalpython is now graalpy. We believe the new name better aligns with the Python ecosystem – let us know how you like it!

Also, GraalVM’s launchers now include symlinks from python and python3 to graalpy for better integration with Python IDEs and tools.

Flask now works on GraalPy! Flask is a micro web framework, with features such as a development server and debugger, support for unit testing, extensions, and more.

1*nFqbc5tJLkJV3-QFpKRz5g.png

GraalPy running a Flask server with benchmark results for importing pygal in AST interpreter mode and bytecode interpreter mode.

We also completed a lot of compatibility work. We switched to a new parser generated from CPython’s new PEG grammar definition, which improves compatibility and enables us to implement the ast module. We also added support for the Tracing API and Profiling API, which enable support for pdb and profile package respectively on GraalPy. We also updated pip to automatically choose the best version for known packages. So when you run pip install pandas, GraalPy will automatically select the versions of pandas and numpy that are tested in our CI.

Additionally, the new bytecode interpreter that we introduced in the previous release is now enabled by default. This change brings better startup performance and memory footprint while retaining good peak performance. For example, the development time actions such as pip install <package> or running import <package> in the REPL are now 20-25% faster and use around 25% less memory on average.

GraalVM LLVM Runtime on Windows

The GraalVM LLVM Runtime for Community Edition is now available on Windows! This also will help us add support for GraalPy and other GraalVM languages on Windows.

It’s still experimental in this release, so please give it a try and share your feedback with us. Get started here.

Polyglot Embedding

We added Context.Builder.allowInnerContextOptions(boolean) which enables a context to spawn inner contexts and modify and override language options. Inner contexts no longer share code with the initial context. The default value for this privilege is determined according to whether Context.Builder.allowAllAccess(boolean) is set or not. Do not enable this privilege in security-sensitive scenarios.

TruffleRuby added several new features:

  • Added the Java.add_to_classpath method to add JAR paths at runtime.
  • Added support for Ruby 3.1’s Hash shorthand and punning syntax, and anonymous block forwarding syntax.
  • Improved interoperability with Java: no more conversion between Java Strings and Ruby Strings at the interop boundary.

We’ve also made several performance and compatibility improvements (in particular, improved interpreter performance by optimizing for better host inlining) — see the full changelog.

Community Updates

We also want to use this opportunity to mention a few updates from the GraalVM community and related projects.

  • Spring Boot 3.0.0 RC1 comes with improved AOT processing and GraalVM Native Image support. For an overview of the latest AOT and Native updates in Spring Framework 6.0 and Spring Boot 3.0, check out this presentation by Stéphane Nicoll and Brian Clozel.
  • Micronaut introduced the new Test Resources feature that enables easy testing against external dependencies (for example via Testcontainers), and works in both JIT and Native Image modes.
  • The Quarkus team recently published a new extensive guide for getting started with Quarkus and GraalVM — check it out.
  • The Helidon team introduced Helidon Níma, a microservices framework based on virtual threads, which shows some promising results.
  • IntelliJ IDEA 2022.2 has added experimental support for debugging native executables produced by GraalVM Native Image.
  • JUnit framework 5.9.1 introduced the @EnabledInNativeImage and @DisabledInNativeImage annotations to enable users to include/exclude testing native executables produced by GraalVM Native Image.
  • The community used GraalVM to compile a Minecraft server to a native executable — see how they did it.

Community contributions

As always we are grateful to the community and our partners in the ecosystem for working with us on this release. There were many helpful reports and contributions on GitHub that help us make GraalVM better for everyone. Here are just a few of them:

  • Support for new JFR events and improved debugging in Native Image were contributed by Red Hat
  • The Jet Brains Intellij IDEA team provided helpful feedback that we are using to improve debugging native executables produced by GraalVM Native Image
  • The Spring Boot and Micronaut teams help us build out the graalvm-reachability repository and native-build-tools
  • The Shopify team contributed to migrating TruffleRuby to TruffleString

Meet Grabbit!

GraalVM now has a mascot — meet Grabbit! It’s actually a hare, but we just love the name “Grabbit”.

1*81iWqmXga91wgjk3qztbog.png

Grabbit — the new GraalVM mascot.

Feel free to use it in your blog posts or presentations about GraalVM — we’ll share a page with the logo and other brand assets for the community soon.

Conclusion

Thanks to the GraalVM community for all the feedback, suggestions, and contributions that went into this release. If you have additional feedback on this release, or suggestions for features that you would like to see in future releases, please share them with us on Slack, GitHub, or Twitter.

— the GraalVM team


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK