Add crac module: Spring Boot 4.2 started by CRaC checkpoint/restore vs JDK AOT cache vs native image

One service, seven start-up configurations measured over ten interleaved rounds on Temurin 25, Zulu 25 CRaC and Oracle GraalVM 25;
the open-file checkpoint failure and its fix, stale environment values, secrets in the checkpoint, warp and CRIU engines, cold page cache.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b5uEyg58znuchZ8C8i
This commit is contained in:
asmhatre
2026-11-29 13:51:08 +05:30
co-authored by Claude Sonnet 5.5
parent de2660e998
commit c0062ea398
33 changed files with 882 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
== machine
Linux 6.18.44-fc-v880
cpus: 2
memory MB: 8023
== plain JVM and AOT cache
openjdk version "25.0.5.1" 2026-11-17 LTS
OpenJDK Runtime Environment Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS, mixed mode, sharing)
== CRaC JVM
openjdk version "25.0.5.1.1" 2026-11-17 LTS
OpenJDK Runtime Environment Zulu25.38+203-CRaC-CA (build 25.0.5.1.1+1-LTS)
OpenJDK 64-Bit Server VM Zulu25.38+203-CRaC-CA (build 25.0.5.1.1+1-LTS, mixed mode, sharing)
engines shipped: criu criuhelper libcriuengine.so libwarp.so
== native-image
native-image 25.0.4 2026-07-21
GraalVM Runtime Environment Oracle GraalVM 25.0.4+7.1 (build 25.0.4+7-LTS-jvmci-b01)
Substrate VM Oracle GraalVM 25.0.4+7.1 (build 25.0.4+7-LTS, serial gc, compressed references)
== Spring
Implementation-Version: 4.2.0
crac-1.5.0.jar
spring-boot-4.2.0.jar
spring-boot-actuator-4.2.0.jar
spring-boot-actuator-autoconfigure-4.2.0.jar
spring-boot-autoconfigure-4.2.0.jar
spring-boot-health-4.2.0.jar
spring-boot-http-converter-4.2.0.jar
spring-boot-jackson-4.2.0.jar
spring-boot-jarmode-tools-4.2.0.jar
spring-boot-micrometer-metrics-4.2.0.jar
spring-boot-micrometer-observation-4.2.0.jar
spring-boot-servlet-4.2.0.jar
spring-boot-tomcat-4.2.0.jar
spring-boot-validation-4.2.0.jar
spring-boot-web-server-4.2.0.jar
spring-boot-webmvc-4.2.0.jar
spring-context-7.1.0.jar
spring-core-7.1.0.jar
spring-webmvc-7.1.0.jar
tomcat-embed-core-11.0.27.jar
+21
View File
@@ -0,0 +1,21 @@
== CRaC checkpoint at start-up (-Dspring.context.checkpoint=onRefresh)
process exited after 6989 ms; checkpoint dir: core.img engine size: 110 MB
INFO 9383 --- [crac-demo] [ main] com.ankurm.crac.CracDemoApplication : Starting CracDemoApplication v1.0.0 using Java 25.0.5.1.1 with PID 9383 (<work>/app/crac-demo-1.0.0.jar started by root in <work>)
RestoreTracker: beforeCheckpoint
[6.927s][info][crac] Checkpoint ...
3230.887277: warp: Checkpoint 9383 to <work>/cp-refresh
3230.929900: warp: Checkpoint successful!
== CRaC checkpoint after warm-up (300 POST + 300 GET, then jcmd JDK.checkpoint)
jcmd JDK.checkpoint returned after 506 ms; process gone after 616 ms; checkpoint size: 136 MB
INFO 9520 --- [crac-demo] [Attach Listener] jdk.crac : Starting checkpoint
RestoreTracker: beforeCheckpoint
[7.441s][info][crac] Checkpoint ...
3238.421212: warp: Checkpoint 9520 to <work>/cp-warm
3238.499849: warp: Checkpoint successful!
== JDK AOT cache (JEP 514), context-only training
training took 11045 ms; 60 MB
== JDK AOT cache, training with the same 300-request warm-up
training took 15222 ms; 68 MB
+19
View File
@@ -0,0 +1,19 @@
== 1. A file opened in a constructor and never closed (profile 'leaky'), checkpoint at start-up
java exit code: 1
WARN 11231 --- [crac-demo] [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to take CRaC checkpoint on refresh
ERROR 11231 --- [crac-demo] [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to take CRaC checkpoint on refresh
Caused by: org.crac.CheckpointException
Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenFileException: <work>/audit.log
checkpoint directory exists: no
== 2. The same mistake, checkpoint requested later with jcmd JDK.checkpoint
11275:
An exception during a checkpoint operation:
jdk.internal.crac.mirror.CheckpointException
Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenFileException: <work>/audit.log
at java.base/jdk.internal.crac.JDKFileResource.lambda$beforeCheckpoint$0(JDKFileResource.java:134)
at java.base/jdk.internal.crac.mirror.Core.checkpointRestore1(Core.java:195)
at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:291)
at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:327)
application still running and answering: pong
+23
View File
@@ -0,0 +1,23 @@
== 3. The fix: open in start(), close in stop() (profile 'managed'), checkpoint with jcmd, restore
orders before checkpoint; audit file has 3 lines
--- log of the checkpointed process (hooks only)
INFO 11435 --- [crac-demo] [ main] o.s.boot.tomcat.TomcatWebServer : Tomcat initialized with port 18771 (http)
INFO 11435 --- [crac-demo] [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO 11435 --- [crac-demo] [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/11.0.27]
INFO 11435 --- [crac-demo] [ main] o.s.boot.tomcat.TomcatWebServer : Tomcat started on port 18771 (http) with context path '/'
ManagedAuditLog: opened <work>/audit.log
INFO 11435 --- [crac-demo] [io-18771-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
ManagedAuditLog: closed <work>/audit.log
RestoreTracker: beforeCheckpoint
--- log of the restored process (hooks only)
RestoreTracker: afterRestore (restore #1)
INFO 11435 --- [crac-demo] [Attach Listener] o.s.c.support.DefaultLifecycleProcessor : Restarting Spring-managed lifecycle beans after JVM restore
INFO 11435 --- [crac-demo] [Attach Listener] o.s.boot.tomcat.TomcatWebServer : Tomcat started on port 18771 (http) with context path '/'
ManagedAuditLog: opened <work>/audit.log
INFO 11435 --- [crac-demo] [Attach Listener] o.s.c.support.DefaultLifecycleProcessor : Spring-managed lifecycle restart completed (restored JVM running for 93 ms)
--- after restore: new order (id continues from the checkpointed counter), audit file now has 4 lines:
{"id":4,"customer":"ada","sku":"X","quantity":1}
created order 1
created order 2
created order 3
created order 4
+6
View File
@@ -0,0 +1,6 @@
== 4. Environment variables and secrets
before checkpoint: {"pid":11657,"restores":0,"greetingAtStartup":"value-at-checkpoint-S3CRET-7f3a91","greetingNow":"value-at-checkpoint-S3CRET-7f3a91","jvmUptimeMs":3954}
restored with DEMO_GREETING=value-at-restore:
after restore: {"pid":11791,"restores":1,"greetingAtStartup":"value-at-checkpoint-S3CRET-7f3a91","greetingNow":"value-at-restore","jvmUptimeMs":123}
occurrences of the checkpoint-time value in core.img: 4
checkpoint file mode: 600 root
+30
View File
@@ -0,0 +1,30 @@
files in the JDK's lib directory that belong to CRaC:
criu
criuhelper
libcriuengine.so
libsimengine.so
libwarp.so
== the same flag on the stock Temurin 25 JDK
Unrecognized VM option 'CRaCCheckpointTo=<work>/cp-temurin'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
engine recorded in the default checkpoint (cp-refresh/engine): warp
process capabilities (CapEff): 000001fffeffffff, uid 0
== -XX:CRaCEngine=warp, checkpoint at start-up then restore
checkpoint directory: core.img engine (2 files); size: 129 MB
RestoreTracker: beforeCheckpoint
[4.243s][info][crac] Checkpoint ...
4184.436746: warp: Checkpoint 24528 to <work>/cp-eng-warp
4184.499576: warp: error: Cannot reset arguments to (-->)00007ffcab2bd075-00007ffcab2bd166: Operation not permitted
4184.499614: warp: error: Cannot reset arguments to 00007ffcab2bd075-00007ffcab2bd166(<--): Operation not permitted
4184.500952: warp: Checkpoint successful!
restored; GET /ping -> pong; Restored CracDemoApplication in 0.251 seconds (process running for 0.256)
== -XX:CRaCEngine=criuengine, checkpoint at start-up then restore
checkpoint directory: core-24639.img core-24641.img core-24642.img (39 files); size: 112 MB
RestoreTracker: beforeCheckpoint
[3.535s][info][crac] Checkpoint ...
restored; GET /ping -> pong; Restored CracDemoApplication in 0.183 seconds (process running for 0.184)
+18
View File
@@ -0,0 +1,18 @@
build wall time: 834 s (mvn -Pnative -DskipTests native:compile, measured around the whole Maven run, 2 vCPU shared with other jobs)
[1/8] Initializing... (16.0s @ 0.17GB)
Java version: 25.0.4+7-LTS, vendor version: Oracle GraalVM 25.0.4+7.1
Graal compiler: optimization level: 2, target machine: x86-64-v3, PGO: ML-inferred
Garbage collector: Serial GC (max heap size: 80% of RAM)
[2/8] Performing analysis... [*****] (173.6s @ 2.02GB)
22,195 types, 31,358 fields, and 109,350 methods found reachable
8,538 types, 5,070 fields, and 22,270 methods registered for reflection
68 types, 71 fields, and 58 methods registered for JNI access
[3/8] Building universe... (19.2s @ 2.34GB)
[4/8] Parsing methods... [********] (72.7s @ 2.58GB)
[5/8] Inlining methods... [***] (9.1s @ 2.76GB)
[6/8] Compiling methods... [*********************] (461.3s @ 3.28GB)
[7/8] Laying out methods... [*****] (26.6s @ 3.10GB)
[8/8] Creating image... [***] (11.6s @ 3.43GB)
94.7s (11.8% of total time) in 3046 GCs | Peak RSS: 4.99GB | CPU load: 1.31
Finished generating 'crac-demo' in 13m 17s.
binary size: 99 MB (target/crac-demo, plus 6 small .so shims)
+18
View File
@@ -0,0 +1,18 @@
rounds: 10 load average before: 0.80 0.94 2.53 cpus: 2
configuration ready ms (median [min..max]) 1st POST ms next 50 ms RSS MB
plain-temurin 3973 [3517..4290] 138.7 2.28 184
plain-zulu-crac 3847 [3378..4270] 129.7 2.57 186
aot-ctx-only 2186 [1890..2457] 121.6 2.43 193
aot-traffic 2077 [1944..2323] 65.0 3.59 192
crac-on-refresh 430 [395..540] 211.3 3.21 170
crac-warm 108 [93..153] 12.1 1.95 152
native 86 [83..118] 3.3 0.40 98
raw ready ms per round:
plain-temurin: 3517 4156 3996 4093 3993 3890 3953 4290 3723 3807
plain-zulu-crac: 3984 3802 3951 3869 4089 4270 3749 3805 3378 3824
aot-ctx-only: 1890 2240 2214 2158 2030 1979 2457 2268 2039 2307
aot-traffic: 2081 2053 1944 2012 2090 2072 2125 1973 2110 2323
crac-on-refresh: 407 428 399 540 448 395 452 437 432 421
crac-warm: 107 109 104 153 93 98 117 104 109 122
native: 90 94 86 87 117 83 118 86 83 85
load average after: 2.22 1.62 2.54
+5
View File
@@ -0,0 +1,5 @@
ready (ms) after dropping the page cache, 5 rounds, interleaved:
plain-temurin: 4462 4196 4304 4342 4091
aot-traffic: 2217 2110 2052 2319 2149
crac-warm: 257 255 207 221 247
native: 216 251 193 249 204