graalvm
Published in

graalvm

GraalVM: 2021 in Review

2021 was quite productive for GraalVM: Together with the community, we published 4 major releases, added a lot of new features, and built great new projects. In this blog post we want to look back at some of the highlights and milestones of this year.

Running Programs Even Faster

Every time you see your applications run faster with GraalVM, that is thanks to the great work done by our compiler team. With every release there are new optimizations and updates for both JIT and AOT compilation modes — in particular, we added the speculative guard movement optimization that improved the geomean throughput score of GraalVM CE on SpecJVM2008 by 4.2%, multiple loop optimizations, optimizations for new hardware architectures, and many more.

All those changes result in improvement reports we get from the community, such as for example accelerating Spark at Facebook, or running Apache Solr with GraalVM as the JDK:

Apache Solr speedup with GraalVM

Another feature requested by the community last year was having GraalVM builds of the latest Java versions, and it was delivered — GraalVM 21.2 introduced support for JDK 16, and 21.3 — for JDK 17. Enjoy using the latest Java features with GraalVM!

Executing JavaScript in Oracle Database

One of the major updates early in the year was the introduction of the Multilingual Engine (MLE). Thanks to MLE and starting with 21c, Oracle Database can execute JavaScript, powered by GraalVM. One of the distinct features of GraalVM along with high performance is embeddability; a previous example of this capability is GraalVM’s Node.js runtime, which runs unmodified Node.js applications via the GraalVM JavaScript engine. For MLE, we leverage Native Image to compile the MLE runtime and all required GraalVM components like the JavaScript runtime — all implemented in Java — into a shared library that is loaded on-demand into a database process.

The MLE Architecture

Since announcing, we saw a lot of positive feedback for it, especially among the APEX community, and there are more features coming up in new releases. Read more about MLE here.

Java on Truffle

Another big update this year was the release of Java on Truffle, also known as the Espresso project. Before Java on Truffle, there were two ways of executing Java on GraalVM: in the context of HotSpot VM with Graal as the top-tier compiler, or via Native Image. With the addition of Java on Truffle, a JVM implementation written in Java using GraalVM’s Truffle framework, there is now an entirely new, metacircular way to run Java on GraalVM:

Ways to execute Java on GraalVM

Java on Truffle enables some interesting use cases. You can embed Java bytecode of a different version in your main Java application (given you have both distributions), dynamically execute Java code in native executable built with Native Image, use it for advanced class redefinition, get access to all Truffle tools and interoperability, and more.

Over the year we’ve done a lot of work on Java on Truffle in terms of both features, like the new Hotswap Plugin API, which allows reloading the code without the need for restarting a running application, and performance — most recently on startup performance in a wide range of benchmarks. Stay tuned for more updates in 2022!

Native Image Improvements

This year we’ve added many features and improvements to GraalVM Native Image. One of the highly requested changes was improving build times, and we worked on this over a couple of releases, resulting in ~20% faster build time and ~9% less memory usage in 21.2, and even more significant improvements in 21.3. Among the run time improvements, Native Image now has a new policy for serial GC, reducing the memory footprint of applications at run-time, and also an “epsilon” GC, with more updates coming up in 22.0.

In June we released the new official Maven and Gradle plugins for Native Image with out-of-the-box support for native JUnit 5 testing, which allows libraries in the Java ecosystem to run their test suites via GraalVM Native Image. It was an important update for Native Image applications, and a great example of collaboration between the GraalVM, JUnit, Micronaut, and Spring teams.

Another important feature was initial support for JFR in Native Image, which was introduced in 21.2 for some system and custom events, and extended in 21.3. This feature is another example of collaboration within the GraalVM community, developed by Oracle Labs and Red Hat.

A major update for Native Image in GraalVM Enterprise was catching up with OpenJDK in peak performance thanks to performance optimizations, profile-guided optimizations, and G1 GC.

Native Image saw a lot of love from the Java community. We kept working closely with many partners in the ecosystem, and this brought great results Spring Native Beta was announced in March, and they’ve made a lot of progress over the year — check out those startup numbers! The Micronaut team implemented new build-time optimizations to take the application startup time down to impressive 7 ms. The Quarkus team were very active in the community and made several valuable contributions to the project. Also, check our live stream recordings with the Helidon and Gluon team members to see how Native Image is beneficial for their projects as well.

If want to learn more about the work Native Image does behind the stage, and in particular about the static analysis, watch this VMIL talk by Christian Wimmer.

Multi-Tier Compilation for Truffle Languages

GraalVM 21.1 introduced multi-tier compilation for languages implemented on Truffle. It’s intended to improve warmup, and is especially beneficial for larger codebases, improving the startup times by 30%-50%. The idea in the multi-tier mode is to separate compilation into two tiers — the faster first-tier, performing fewer optimizations, but producing code faster, and the slower second-tier, applying more optimizations for the best peak performance.

Warmup improvement with multi-tier compilation

Watch this session to learn about the performance benefits that multi-tier compilation brings for Truffle languages such as Graal.js, TruffleRuby, and Java on Truffle.

Updated CPU Sampler for Truffle languages

GraalVM comes with a built-in CPU Sampler, which recently got a major update. In addition to increased precision of the sampling output, it now has new SVG flamegraph output and integration with VisualVM and Chrome Inspector. Check out this article for all the details and examples.

Developer Experience

One of our priorities is also improving the experience for developers working with GraalVM. Above we’ve talked about many improvements in Native Image, and there are more coming in 22.0, like the new build output.

We also published and constantly improved our Extensions Pack for VS Code, so you can easily install new versions of GraalVM, build and debug polyglot applications, create Java microservices with GraalVM and Micronaut, and more. Give it a try yourself, or see how you can use it!

Integration between GraalVM Tools for Java and VisualVM

We also created a series of cheat sheets and tutorials, so you can have all the helpful commands and resources close at hand:

Our website, graalvm.org, went through a major makeover — in addition to new visual style, it now also has brand new language pages, quick access to key features, community resources and much more. We also reorganized the GraalVM documentation so now it’s easier than ever to contribute to it— see how!

The Community and Ecosystem

Like many other teams during the pandemic, we gave online streams a try and it worked out pretty well:) We did over 20 live streams this year to present new releases and features, talk with our team and community members, and answer your questions. It’s great to be able to interact with our community, even if just online. Follow the GraalVM Youtube channel if you haven’t yet, and let us know what other topics you would like to see covered in our streams!

GraalVM on Youtube

Also, there were so many great projects and updates in the community this year, that it would be impossible to list all of them. But here are a few!

  • GraalVM’s core repository reached over 16,000 ⭐️ on GitHub! We also received more than 700 pull requests from contributors;
  • Shopify made multiple contributions to TruffleRuby and shared their experience with the community;
  • We saw new community language implementations, such as for example Truffle Mal;
  • In The Modern Java Platform article, James Ward wrote about how GraalVM is beneficial for building JVM applications, and in particular for working with Scala;
  • Java workloads on Azure showed great startup with Native Image as well:)
  • AWS SDK for Java 2.x added out-of-the-box support for Native Image compilation;
  • GraalVM polyglot enabled more interesting use cases;
  • Lightbend rewrote the Cloudflow’s CLI from Go to Scala with GraalVM for both great productivity and instant startup;
  • Matt Raible and Josh Long made JHipster applications work with Spring Native;
  • Microdoc announced their plans for an embedded product with GraalVM.
  • Check out this cool way to analyze Native Image call paths with Quarkus and Neo4j!

If you have feedback for us, feel free to share it via Slack, GitHub, or Twitter (and fill our developer survey!).

Thank you all for being a part of the amazing GraalVM community, and see you all in 2022!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alina Yurenko

Alina Yurenko

I love all things tech & community. Developer Advocate for @graalvm, blog posts about programming, communities, productivity.