Now developers can try CRaC for themselves. Today Azul announces the general availability of Azul Zulu Builds of OpenJDK for Java 17 with CRaC support in x86, 64-bit configurations.
When a Java application runs, the JVM goes through the process of loading, initializing, and optimizing the code used by the application, including libraries, frameworks, and other components to reach the optimal performance level.
Each time the application restarts, it has no record or memory of previous times it has run and the work it performed.
As a result, it has to restart, extending valuable startup and warmup times and using precious resources.
General Availability to Speed Up Startup and Warmup
Speeding up startup and warmup has been one of Java’s perennial challenges. OpenJDK’s CRaC (Coordinated Restore at Checkpoint) project is one of the most promising solutions.
Frameworks like Micronaut, Quarkus and Spring have realized orders of magnitude improvement with CRaC.
The builds are commercially supported as part of Azul Platform Core and are also available for free download and use with no restrictions.
From Micronaut to Spring Boot
“CRaC has generated immense interest among the Java developer community and provides a compelling, resource-efficient approach for improving startup and warmup times. Azul is well known for originating this project, so it came as no surprise that they would also deliver the world’s first production-ready builds of OpenJDK with commercial CRaC support. “
— Sergio del Amo, Micronaut Product Development Lead.
“Project CRaC’s checkpoint restore approach is very promising for the immediate startup of Spring applications on the JVM. Our collaboration with Azul delivered some great initial results already.“
— Juergen Hoeller, project lead and co-founder of the Spring Framework project.
How Does It Work?
The OpenJDK CRaC Project defines public Java APIs that allow for coordinating application resources during checkpoint and restore operations. This is important because applications can be restored in different environments than where the checkpoint was created; they may have different time zones, database connection strings, etc.
CRaC allows a running application to pause, snapshot its state, and store it for later use – even on a different machine. It saves the full context of the application process as an image, including its state and memory.
When the application restarts later, it skips startup and warmup and jumps right to that stored profile. It rapidly reloads the entire application and its state so it can continue from the point where the checkpoint was created. This approach reduces Java application startup and warmup times by several orders of magnitude, meaning milliseconds instead of seconds or minutes.
CRaC allows Java applications to leverage checkpoint-and-restore mechanisms and coordinate with them as necessary. Checkpoint-and-restore operations save the state of the JVM and the Java application to an image. The Java application can then be resumed from the image at a future point in time. Think of when you finish using a laptop, and you close it. Later, when you open it, CRaC would be like having the laptop operating at the same to performance as when you closed the lid.
In 2022 tests, OpenJDK builds with CraC support showed some very impressive results:
PlatformBefore CRaCWith CRaCSpring boot4 seconds38 millisecondsMicronaut1 second40 millisecondsQuarkus9 seconds53 millisecondsOpenJDK builds with and without CRaC
Learn how to get CraC in your build of OpenJDK
To use CRaC with the Azul Zulu Build of OpenJDK for Java 17, visit our Downloads page and select your build. You can also learn more about Azul Platform Core from our website.
The post Reduce Java Application Startup and Warmup Times with CRaC appeared first on foojay.