GraalVM.org
Why GraalVM native image?
In short, using GraalVM native image to compile Java applications into native executables has the potential to save CPU and Memory resources and this can translate into saving $Money in cloud hosting costs.
GraalVM native image achieves this by ahead-of-time compiling the Java application into a native executable. This results in faster startup times and lower memory consumption compared to traditional JVM-based applications.
This means we can see charts like this one below ...
Have a closer look at JVM vs GraalVM native image comparison.
How do Avaje Libraries help?
Avaje libraries avoid using Reflection, Dynamic proxies and Classpath scanning so they are well suited to be used in GraalVM native image applications.
Avaje libraries also provide specific support for GraalVM native image where needed.
For example, avaje-config specifies resource loading for application.properties and
application.yaml etc.
| avaje-config |
avaje-config is a configuration library that supports GraalVM native image. It supports loading configuration from properties and yaml files as well as environment variables, system properties and plugins (like AWS AppConfig). |
|---|---|
| avaje-http |
avaje-http generates adapter code for |
| avaje-jsonb |
avaje-jsonb is a JSON binding library that uses code generation to create serializers and deserializers for Java objects. This approach avoids the need for reflection, making it ideal for GraalVM native image. |
| avaje-simple-logger |
avaje-simple-logger is a simple structured JSON logger that is well suited to GraalVM native image applications. No reflection, lightweight, uses avaje-jsonb for optimised json serialisation and uses build time initialisation with GraalVM native image. |
GraalVM Considerations
While GraalVM native image offers significant benefits, there are some considerations to keep in mind:
- Not all Java libraries are compatible with GraalVM native image. It's important to verify that the libraries you plan to use are supported.
- GraalVM native image may not support all Java features, such as dynamic class loading. Ensure that your application does not rely on unsupported features.
- Building a GraalVM native image can be more complex and time-consuming than building a traditional Java application. Be prepared for a potentially longer build process.
