Java dominates enterprise applications. But in the cloud, Java is more expensive than some competitors. Native compilation with GraalVM makes Java in the cloud cheaper: It creates applications that start much faster and use less memory.
So native compilation raises many questions for all Java users: How does native Java change development? When should we switch to native Java? When should we not? And what framework should we use for native Java? This series will provide answers to these questions.
Series Contents
Revolutionizing Java with GraalVM Native Image
GraalVM Native Image is an ahead-of-time compiler that generates native Java executables. These executables start very fast and use less CPU and memory. This makes Java in the cloud cheaper. GraalVM can even achieve peak throughput on par with the JVM. Many Java frameworks already support GraalVM, such as Spring Boot, Micronaut, Quarkus, Gluon, etc.
Kubernetes Native Java with Quarkus
Quarkus is an industry leader in startup time and memory utilization for native and JVM-based Java applications. This reduces cloud costs. Kubernetes is a first-class deployment platform in Quarkus with support for its primitives and features. Developers can use their Java knowledge of APIs like Jakarta EE, MicroProfile, Spring, etc. Applications can be imperative or reactive - or both!
Native Java in The Real World
Microservices on Kubernetes are the native Java sweet spot: they have the most significant framework and Java runtime overhead. Native Java needs more effort to build, debug, test, deploy & profile. The application framework should fully support native Java in production. Native Java adoption can be incremental. But a native Java application only works if all its libraries support native Java.
Cloud Native Java with the Micronaut Framework
The Micronaut framework provides a solid foundation for building Cloud Native Java microservices. It reduces the use of Java reflection, runtime proxy generation, and dynamic classloading. Tight integration with GraalVM Ahead-of-Time Compilation (AOT) has seen the usage of the Micronaut framework grow. Active compilation-time checking increases type safety and improves developer productivity.
Go Native with Spring Boot and GraalVM
Spring Boot 3 & Spring Framework 6, due in late 2022, will have built-in support for native Java. For Spring Framework 5.x & Spring Boot 2.x, Spring Native is the way to go. Spring Native provides integrations for Spring's vast ecosystem of libraries. It also has a component model that allows you to extend native compilation support for other libraries.
Standardizing Native Java: Aligning GraalVM and OpenJDK
Native Java is essential for Java to remain relevant in the evolving cloud world. But it is not a solved problem yet. And the development lifecycle needs to adapt as well. Standardization through Project Leyden is key to the success of native Java. Native Java needs to be brought into OpenJDK to enable co-evolution with other ongoing enhancements.