
Spring Boot since 3.2
- CRaC support in the framework as of Spring Boot 3.2
- Spring Framework coordinates bean lifecycle around the checkpoint
OpenJDK project · sponsored by the HotSpot Group
Coordinated Restore at Checkpoint takes an image of a running, warmed-up Java instance and restores from it. The application skips its own start-up: class loading and JIT compilation have already happened.
cold start restored from a CRaC image
38 ms restored 3898 ms cold
33 ms restored 980 ms cold
46 ms restored 1001 ms cold
53 ms restored 4352 ms cold
Measured by the project on jdk14-crac: Intel i7-5500U laptop, 16 GB RAM, SSD, Linux 5.7.4, in a ubuntu:18.04 based image. Collected with org-crac/utils/full-bench.sh. The absolute numbers are of their time; the ratio between them is the point. Full results and how to reproduce them.
What CRaC is
Checkpoint/restore mechanisms can snapshot a process, but a Java application usually holds things a snapshot cannot carry — open sockets, files, pooled connections, timers. CRaC's contribution is a mechanism-agnostic API through which the runtime tells the application a checkpoint is coming, so it can release those things and reacquire them on restore.
The API
org.crac:crac mirrors jdk.crac and degrades to a no-op on a runtime without CRaC support, so an application can depend on it unconditionally.
public class Cache implements Resource {
public void beforeCheckpoint(Context<? extends Resource> c) {
// release what cannot survive the image
}
public void afterRestore(Context<? extends Resource> c) {
// reacquire it
}
}First you need a runtime
CRaC has to be built into the runtime. The upstream project's own builds come first; vendor builds follow, and each vendor documents its own additions.
How a deployment works
The image has to come from somewhere, and that shapes the deployment: the application is run and exercised first, and the image it produces becomes part of the bundle that ships.
Deploy to a canary environment and send it real requests, so classes load and the JIT compiles.
jcmd <pid> JDK.checkpointThe image of the JVM and the application becomes part of the deployment bundle.
java -XX:CRaCRestoreFrom=./imageThe restored process already has its loaded classes and compiled code.
Used by
Each of these releases CRaC support, so an application usually inherits the coordination rather than writing it.


crac feature on micronaut.io/launch
io.github.crac.com.amazonawsEach links to that project's own documentation of it.
Take part
The work happens on the OpenJDK mailing list and in the repositories. Nothing here is a product roadmap.