Add aot-cache module: the JDK 25 AOT cache on Spring Boot 4.1 vs AppCDS, Spring AOT and GraalVM native
A Spring Boot 4.1.1 order service started 12 ways (plain and extracted jar, Spring AOT output, AppCDS, AOT cache trained with and without traffic, JDK 27, native image), ten interleaved rounds each, with first-request latency; 24 cache-mismatch cases; Docker layer arithmetic. Transcripts are in output/ (no docs/ folder). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TF9JWFvJSNm6HVzswzZU5a
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# machine
|
||||
cpus: 2 memory: 8032 MB kernel: 6.18.44-fc-v37
|
||||
|
||||
# JDK 25 (the JVM the article is about)
|
||||
openjdk version "25.0.4.1" 2026-08-18 LTS
|
||||
OpenJDK Runtime Environment Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS)
|
||||
OpenJDK 64-Bit Server VM Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS, mixed mode, sharing)
|
||||
|
||||
# JDK 27 (the comparison)
|
||||
openjdk version "27" 2026-09-15
|
||||
OpenJDK Runtime Environment Temurin-27+35 (build 27+35)
|
||||
OpenJDK 64-Bit Server VM Temurin-27+35 (build 27+35, mixed mode, sharing)
|
||||
|
||||
# GraalVM (native image)
|
||||
native-image 25.0.2 2026-01-20
|
||||
GraalVM Runtime Environment GraalVM CE 25.0.2+10.1 (build 25.0.2+10-jvmci-b01)
|
||||
|
||||
# libraries
|
||||
hibernate-validator-9.1.3.Final
|
||||
jackson-databind-3.1.5
|
||||
spring-boot-4.1.1
|
||||
spring-core-7.0.9
|
||||
spring-webmvc-7.0.9
|
||||
tomcat-embed-core-11.0.24
|
||||
@@ -0,0 +1,14 @@
|
||||
== build: plain jar (mvn package)
|
||||
== build: jar with Spring AOT output (mvn -Pnative package; this does NOT compile a native image)
|
||||
initializers in plain jar: 0
|
||||
initializers in Spring AOT jar: 1
|
||||
== extract both jars (java -Djarmode=tools -jar app.jar extract)
|
||||
/home/claude/spring-boot-demo/aot-cache/work/ext:
|
||||
app.jar
|
||||
lib
|
||||
|
||||
/home/claude/spring-boot-demo/aot-cache/work/ext-springaot:
|
||||
app.jar
|
||||
lib
|
||||
== build: the same service after a one-line change (the unit price in OrderService), for the mismatch and layer checks
|
||||
edited: 20: BigDecimal unit = BigDecimal.valueOf(5_99, 2);
|
||||
@@ -0,0 +1,17 @@
|
||||
# training runs (JDK 25.0.4.1 unless noted); wall time includes JVM start, context start and cache creation
|
||||
AppCDS (ArchiveClassesAtExit) 4741 ms appcds.jsa (38 MB)
|
||||
AOT cache, fat jar, context-only 8219 ms fat.aot (56 MB)
|
||||
AOT cache, context-only training 7916 ms refresh.aot (59 MB)
|
||||
AOT cache, traffic training 10157 ms traffic.aot (66 MB)
|
||||
AOT cache + Spring AOT, context-only 7164 ms springaot.aot (57 MB)
|
||||
AOT cache + Spring AOT, traffic 8733 ms springaot-traffic.aot (64 MB)
|
||||
AOT cache on JDK 27, context-only 9292 ms refresh27.aot (62 MB)
|
||||
AOT cache on JDK 27, trained under ZGC 9426 ms zgc27.aot (62 MB)
|
||||
|
||||
# what the JVM said at warning level while writing the context-only AOT cache (count, then the distinct kinds)
|
||||
warning lines: 122
|
||||
96 [warning][aot] Skipping <class>: Unsupported location
|
||||
4 [warning][aot] Skipping <class>: Unlinked class not supported by AOTClassLinking
|
||||
4 [warning][aot] Skipping <class>: Failed verification
|
||||
3 [warning][aot] Skipping <class>: JFR event class
|
||||
2 [warning][aot] Skipping <class>: Not in loaded state
|
||||
@@ -0,0 +1,138 @@
|
||||
# 12 configurations x 10 rounds; one unrecorded warm-up round first (so cache files are in the page cache)
|
||||
|
||||
== medians of 10 runs (min..max in brackets), milliseconds; rss in MB
|
||||
configuration ready (exec->200) Boot 'Started in' 1st POST /orders next 50 (median) RSS
|
||||
1 jvm-fat-jar 4630.5 [4281..4931] 3683.5 [3455..3954] 204.0 [166.6..230.7] 4.5 194.0
|
||||
2 jvm-extracted 3919.5 [3486..4018] 3242.0 [2890..3400] 173.3 [146.6..191.7] 4.8 189.0
|
||||
3 jvm+spring-aot 3162.0 [2991..3500] 2552.0 [2419..2907] 201.8 [165.3..254.3] 4.5 183.0
|
||||
4 appcds 2582.5 [2436..2730] 2181.0 [2022..2330] 164.3 [133.9..170.2] 4.8 195.0
|
||||
5 aot-cache fat-jar 3247.0 [3096..3507] 2553.5 [2432..2787] 156.6 [144.9..186.6] 4.7 235.0
|
||||
6 aot-cache context-only 2021.5 [1948..2253] 1568.0 [1495..1785] 142.8 [116.1..160.0] 4.8 218.0
|
||||
7 aot-cache traffic 1948.5 [1777..2142] 1623.5 [1406..1775] 67.7 [47.5..101.8] 4.5 198.5
|
||||
8 aot-cache+spring-aot 1588.5 [1482..1674] 1120.5 [1030..1218] 146.6 [131.4..163.9] 4.5 188.0
|
||||
9 aot-cache+spring-aot traffic 1436.0 [1372..1651] 1069.0 [1015..1280] 89.3 [65.9..113.0] 4.2 184.0
|
||||
10 jdk27 plain 3779.5 [3595..4205] 3122.5 [2919..3408] 164.8 [139.9..176.8] 4.6 234.0
|
||||
11 jdk27 aot-cache 1983.0 [1840..2181] 1571.5 [1444..1763] 138.2 [117.9..191.0] 4.2 195.5
|
||||
12 native image 133.0 [127..171] 101.5 [90..133] 5.3 [4.6..6.0] 1.0 120.0
|
||||
|
||||
== every run
|
||||
1 jvm-fat-jar 1 ready=4407 started=3460 first=201.9 second=6.4 next50=3.2 rss=186
|
||||
2 jvm-extracted 1 ready=3486 started=2890 first=187.6 second=7.4 next50=4.0 rss=189
|
||||
3 jvm+spring-aot 1 ready=3111 started=2495 first=203.0 second=8.9 next50=4.5 rss=189
|
||||
4 appcds 1 ready=2535 started=2133 first=166.6 second=12.8 next50=4.8 rss=190
|
||||
5 aot-cache fat-jar 1 ready=3096 started=2432 first=157.2 second=11.4 next50=4.3 rss=234
|
||||
6 aot-cache context-only 1 ready=1948 started=1555 first=133.0 second=6.0 next50=3.4 rss=211
|
||||
7 aot-cache traffic 1 ready=1984 started=1642 first=47.5 second=5.5 next50=4.5 rss=200
|
||||
8 aot-cache+spring-aot 1 ready=1482 started=1030 first=153.1 second=7.2 next50=4.4 rss=189
|
||||
9 aot-cache+spring-aot traffic 1 ready=1372 started=1057 first=73.2 second=11.0 next50=3.5 rss=184
|
||||
10 jdk27 plain 1 ready=3595 started=2919 first=165.6 second=13.0 next50=4.5 rss=224
|
||||
11 jdk27 aot-cache 1 ready=1890 started=1517 first=135.2 second=7.1 next50=3.4 rss=195
|
||||
12 native image 1 ready=127 started=90 first=4.6 second=0.9 next50=0.7 rss=120
|
||||
1 jvm-fat-jar 2 ready=4495 started=3692 first=166.6 second=20.1 next50=4.2 rss=195
|
||||
2 jvm-extracted 2 ready=3725 started=3117 first=173.6 second=7.5 next50=4.1 rss=191
|
||||
3 jvm+spring-aot 2 ready=3121 started=2522 first=199.1 second=10.0 next50=4.1 rss=188
|
||||
4 appcds 2 ready=2496 started=2104 first=166.9 second=8.3 next50=4.2 rss=200
|
||||
5 aot-cache fat-jar 2 ready=3250 started=2579 first=186.6 second=17.7 next50=4.6 rss=239
|
||||
6 aot-cache context-only 2 ready=2029 started=1568 first=140.9 second=16.2 next50=3.5 rss=218
|
||||
7 aot-cache traffic 2 ready=1840 started=1506 first=76.5 second=9.3 next50=3.4 rss=200
|
||||
8 aot-cache+spring-aot 2 ready=1550 started=1070 first=131.4 second=14.7 next50=5.0 rss=188
|
||||
9 aot-cache+spring-aot traffic 2 ready=1444 started=1070 first=78.5 second=5.8 next50=4.2 rss=185
|
||||
10 jdk27 plain 2 ready=3767 started=3121 first=164.1 second=8.4 next50=3.9 rss=219
|
||||
11 jdk27 aot-cache 2 ready=1844 started=1444 first=124.8 second=6.0 next50=4.2 rss=196
|
||||
12 native image 2 ready=171 started=133 first=5.6 second=1.4 next50=1.0 rss=120
|
||||
1 jvm-fat-jar 3 ready=4281 started=3455 first=188.9 second=7.0 next50=4.1 rss=187
|
||||
2 jvm-extracted 3 ready=3944 started=3315 first=163.8 second=8.1 next50=4.0 rss=191
|
||||
3 jvm+spring-aot 3 ready=2991 started=2419 first=254.3 second=9.6 next50=4.4 rss=177
|
||||
4 appcds 3 ready=2436 started=2049 first=170.2 second=7.7 next50=4.5 rss=198
|
||||
5 aot-cache fat-jar 3 ready=3127 started=2478 first=156.1 second=8.6 next50=4.4 rss=231
|
||||
6 aot-cache context-only 3 ready=2020 started=1601 first=149.9 second=12.2 next50=4.7 rss=219
|
||||
7 aot-cache traffic 3 ready=1777 started=1406 first=65.2 second=6.2 next50=4.2 rss=200
|
||||
8 aot-cache+spring-aot 3 ready=1547 started=1066 first=134.8 second=6.7 next50=5.5 rss=190
|
||||
9 aot-cache+spring-aot traffic 3 ready=1383 started=1015 first=84.9 second=6.3 next50=4.7 rss=184
|
||||
10 jdk27 plain 3 ready=3704 started=3067 first=139.9 second=7.2 next50=4.4 rss=237
|
||||
11 jdk27 aot-cache 3 ready=1840 started=1494 first=125.0 second=9.8 next50=4.1 rss=196
|
||||
12 native image 3 ready=157 started=131 first=5.6 second=1.2 next50=0.9 rss=120
|
||||
1 jvm-fat-jar 4 ready=4665 started=3675 first=190.9 second=7.0 next50=4.6 rss=196
|
||||
2 jvm-extracted 4 ready=3837 started=3188 first=191.7 second=7.7 next50=5.2 rss=190
|
||||
3 jvm+spring-aot 4 ready=3205 started=2568 first=165.3 second=12.6 next50=4.0 rss=177
|
||||
4 appcds 4 ready=2450 started=2022 first=168.7 second=11.6 next50=3.7 rss=193
|
||||
5 aot-cache fat-jar 4 ready=3244 started=2644 first=151.2 second=7.2 next50=4.9 rss=229
|
||||
6 aot-cache context-only 4 ready=2012 started=1495 first=126.3 second=11.3 next50=4.0 rss=205
|
||||
7 aot-cache traffic 4 ready=1899 started=1537 first=70.1 second=12.4 next50=5.5 rss=186
|
||||
8 aot-cache+spring-aot 4 ready=1644 started=1207 first=163.0 second=13.2 next50=4.5 rss=188
|
||||
9 aot-cache+spring-aot traffic 4 ready=1472 started=1144 first=65.9 second=10.6 next50=4.2 rss=184
|
||||
10 jdk27 plain 4 ready=3712 started=3060 first=176.8 second=7.3 next50=4.7 rss=236
|
||||
11 jdk27 aot-cache 4 ready=1988 started=1608 first=147.4 second=10.8 next50=4.0 rss=195
|
||||
12 native image 4 ready=127 started=94 first=5.0 second=1.1 next50=1.0 rss=120
|
||||
1 jvm-fat-jar 5 ready=4668 started=3654 first=217.1 second=7.7 next50=4.5 rss=203
|
||||
2 jvm-extracted 5 ready=4018 started=3400 first=180.4 second=10.5 next50=5.2 rss=196
|
||||
3 jvm+spring-aot 5 ready=3500 started=2907 first=177.4 second=12.6 next50=4.5 rss=186
|
||||
4 appcds 5 ready=2690 started=2267 first=133.9 second=9.2 next50=4.5 rss=197
|
||||
5 aot-cache fat-jar 5 ready=3169 started=2456 first=174.6 second=8.8 next50=5.1 rss=234
|
||||
6 aot-cache context-only 5 ready=2253 started=1785 first=144.7 second=9.3 next50=5.8 rss=218
|
||||
7 aot-cache traffic 5 ready=1939 started=1622 first=101.8 second=7.7 next50=4.5 rss=194
|
||||
8 aot-cache+spring-aot 5 ready=1591 started=1143 first=142.9 second=10.1 next50=4.3 rss=188
|
||||
9 aot-cache+spring-aot traffic 5 ready=1461 started=1126 first=96.8 second=6.1 next50=4.0 rss=184
|
||||
10 jdk27 plain 5 ready=3709 started=3007 first=174.4 second=8.6 next50=5.0 rss=230
|
||||
11 jdk27 aot-cache 5 ready=1987 started=1589 first=191.0 second=6.7 next50=4.5 rss=195
|
||||
12 native image 5 ready=136 started=96 first=6.0 second=1.0 next50=1.0 rss=119
|
||||
1 jvm-fat-jar 6 ready=4524 started=3575 first=196.3 second=8.5 next50=4.4 rss=195
|
||||
2 jvm-extracted 6 ready=3986 started=3300 first=150.2 second=10.1 next50=4.8 rss=176
|
||||
3 jvm+spring-aot 6 ready=3108 started=2560 first=217.2 second=13.3 next50=4.3 rss=177
|
||||
4 appcds 6 ready=2730 started=2330 first=152.3 second=7.5 next50=5.0 rss=197
|
||||
5 aot-cache fat-jar 6 ready=3399 started=2698 first=154.3 second=9.4 next50=5.2 rss=238
|
||||
6 aot-cache context-only 6 ready=2211 started=1697 first=151.7 second=14.4 next50=5.7 rss=218
|
||||
7 aot-cache traffic 6 ready=1872 started=1542 first=61.0 second=8.4 next50=5.2 rss=198
|
||||
8 aot-cache+spring-aot 6 ready=1624 started=1150 first=135.1 second=12.4 next50=5.7 rss=188
|
||||
9 aot-cache+spring-aot traffic 6 ready=1380 started=1051 first=107.5 second=11.7 next50=4.8 rss=185
|
||||
10 jdk27 plain 6 ready=4103 started=3408 first=168.7 second=7.7 next50=5.1 rss=249
|
||||
11 jdk27 aot-cache 6 ready=1961 started=1570 first=141.3 second=13.2 next50=5.0 rss=197
|
||||
12 native image 6 ready=131 started=105 first=5.0 second=2.7 next50=1.2 rss=119
|
||||
1 jvm-fat-jar 7 ready=4787 started=3913 first=224.4 second=10.0 next50=4.7 rss=197
|
||||
2 jvm-extracted 7 ready=3899 started=3237 first=165.2 second=8.8 next50=5.4 rss=189
|
||||
3 jvm+spring-aot 7 ready=3294 started=2623 first=172.8 second=8.7 next50=4.8 rss=184
|
||||
4 appcds 7 ready=2592 started=2172 first=162.1 second=9.6 next50=4.8 rss=205
|
||||
5 aot-cache fat-jar 7 ready=3347 started=2528 first=176.4 second=7.8 next50=4.8 rss=236
|
||||
6 aot-cache context-only 7 ready=1989 started=1567 first=116.1 second=7.3 next50=5.5 rss=218
|
||||
7 aot-cache traffic 7 ready=2111 started=1771 first=100.5 second=13.5 next50=4.5 rss=200
|
||||
8 aot-cache+spring-aot 7 ready=1597 started=1147 first=152.7 second=10.4 next50=3.9 rss=188
|
||||
9 aot-cache+spring-aot traffic 7 ready=1651 started=1280 first=85.4 second=9.1 next50=5.2 rss=185
|
||||
10 jdk27 plain 7 ready=3825 started=3124 first=166.7 second=8.9 next50=4.5 rss=240
|
||||
11 jdk27 aot-cache 7 ready=2033 started=1690 first=153.9 second=7.3 next50=5.5 rss=195
|
||||
12 native image 7 ready=132 started=100 first=4.9 second=1.3 next50=1.2 rss=120
|
||||
1 jvm-fat-jar 8 ready=4608 started=3729 first=211.0 second=8.0 next50=5.0 rss=192
|
||||
2 jvm-extracted 8 ready=4008 started=3345 first=180.4 second=8.2 next50=4.5 rss=181
|
||||
3 jvm+spring-aot 8 ready=3095 started=2479 first=214.1 second=8.6 next50=5.0 rss=177
|
||||
4 appcds 8 ready=2573 started=2199 first=161.4 second=8.6 next50=5.0 rss=192
|
||||
5 aot-cache fat-jar 8 ready=3177 started=2462 first=152.9 second=7.7 next50=4.6 rss=230
|
||||
6 aot-cache context-only 8 ready=1981 started=1528 first=160.0 second=37.6 next50=5.0 rss=218
|
||||
7 aot-cache traffic 8 ready=2142 started=1775 first=62.3 second=8.7 next50=4.1 rss=187
|
||||
8 aot-cache+spring-aot 8 ready=1586 started=1098 first=163.9 second=12.0 next50=5.3 rss=188
|
||||
9 aot-cache+spring-aot traffic 8 ready=1412 started=1047 first=93.3 second=9.0 next50=5.0 rss=184
|
||||
10 jdk27 plain 8 ready=3792 started=3125 first=152.4 second=11.5 next50=5.1 rss=235
|
||||
11 jdk27 aot-cache 8 ready=1979 started=1529 first=122.5 second=6.7 next50=3.8 rss=195
|
||||
12 native image 8 ready=166 started=117 first=5.3 second=1.5 next50=1.1 rss=119
|
||||
1 jvm-fat-jar 9 ready=4653 started=3760 first=230.7 second=10.4 next50=4.2 rss=193
|
||||
2 jvm-extracted 9 ready=3728 started=3060 first=173.0 second=8.9 next50=4.8 rss=182
|
||||
3 jvm+spring-aot 9 ready=3266 started=2544 first=200.6 second=10.7 next50=5.0 rss=182
|
||||
4 appcds 9 ready=2596 started=2244 first=136.5 second=7.9 next50=5.2 rss=192
|
||||
5 aot-cache fat-jar 9 ready=3507 started=2787 first=162.2 second=8.0 next50=4.8 rss=242
|
||||
6 aot-cache context-only 9 ready=2152 started=1720 first=155.7 second=12.1 next50=4.8 rss=219
|
||||
7 aot-cache traffic 9 ready=2088 started=1731 first=58.5 second=11.4 next50=4.0 rss=198
|
||||
8 aot-cache+spring-aot 9 ready=1674 started=1218 first=137.0 second=11.3 next50=4.2 rss=188
|
||||
9 aot-cache+spring-aot traffic 9 ready=1428 started=1068 first=113.0 second=10.8 next50=4.1 rss=184
|
||||
10 jdk27 plain 9 ready=4205 started=3396 first=157.9 second=10.0 next50=4.7 rss=224
|
||||
11 jdk27 aot-cache 9 ready=2181 started=1763 first=117.9 second=6.7 next50=4.0 rss=196
|
||||
12 native image 9 ready=133 started=98 first=5.4 second=1.4 next50=1.1 rss=120
|
||||
1 jvm-fat-jar 10 ready=4931 started=3954 first=206.1 second=8.8 next50=4.8 rss=193
|
||||
2 jvm-extracted 10 ready=3940 started=3247 first=146.6 second=12.8 next50=4.8 rss=185
|
||||
3 jvm+spring-aot 10 ready=3203 started=2587 first=206.7 second=8.9 next50=4.6 rss=187
|
||||
4 appcds 10 ready=2607 started=2190 first=169.4 second=7.8 next50=5.2 rss=193
|
||||
5 aot-cache fat-jar 10 ready=3495 started=2699 first=144.9 second=8.1 next50=3.7 rss=241
|
||||
6 aot-cache context-only 10 ready=2023 started=1568 first=134.5 second=32.5 next50=4.5 rss=218
|
||||
7 aot-cache traffic 10 ready=1958 started=1625 first=74.3 second=6.1 next50=5.1 rss=199
|
||||
8 aot-cache+spring-aot 10 ready=1556 started=1095 first=150.2 second=9.2 next50=4.3 rss=188
|
||||
9 aot-cache+spring-aot traffic 10 ready=1575 started=1213 first=107.0 second=6.5 next50=4.0 rss=184
|
||||
10 jdk27 plain 10 ready=4010 started=3356 first=156.0 second=7.2 next50=4.4 rss=233
|
||||
11 jdk27 aot-cache 10 ready=2016 started=1573 first=171.6 second=7.8 next50=4.5 rss=196
|
||||
12 native image 10 ready=133 started=103 first=5.4 second=1.2 next50=1.0 rss=120
|
||||
@@ -0,0 +1,9 @@
|
||||
# GraalVM: native-image 25.0.2 2026-01-20
|
||||
21,929 types, 31,331 fields, and 99,355 methods found reachable
|
||||
36.0s (11.7% of total time) in 2209 GCs | Peak RSS: 4.70GB | CPU load: 1.86
|
||||
Finished generating 'aot-cache' in 5m 6s.
|
||||
BUILD SUCCESS
|
||||
Total time: 05:18 min
|
||||
/home/claude/spring-boot-demo/aot-cache/work/aot-cache-native 99 MB
|
||||
/home/claude/spring-boot-demo/aot-cache/work/app.jar 22 MB
|
||||
build wall time: 320 s
|
||||
@@ -0,0 +1,152 @@
|
||||
# cache: /home/claude/spring-boot-demo/aot-cache/work/refresh.aot, trained on JDK 25.0.4.1, extracted layout, default GC (G1), 2 CPUs
|
||||
|
||||
== control: the same JVM, the same jar, the same path
|
||||
result: started, ready after 1987 ms (Started AotCacheApplication in 1.538 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
== the application jar was rebuilt after a one-line code change, default AOTMode=auto
|
||||
result: started, ready after 4124 ms (Started AotCacheApplication in 3.453 seconds)
|
||||
log: [warning][aot] This file is not the one used while building the AOT cache: 'app.jar', timestamp has changed, size has changed
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)
|
||||
log: [error ][aot] Unable to map shared spaces
|
||||
|
||||
== the same, with -XX:AOTMode=on
|
||||
result: did not start (exit code 1)
|
||||
log: [warning][aot] This file is not the one used while building the AOT cache: 'app.jar', timestamp has changed, size has changed
|
||||
log: [error ][aot] shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] unrecoverable error
|
||||
|
||||
== a dependency jar has a different modification time (same bytes)
|
||||
result: started, ready after 3865 ms (Started AotCacheApplication in 3.201 seconds)
|
||||
log: [warning][aot] This file is not the one used while building the AOT cache: 'lib/spring-core-7.0.9.jar', timestamp has changed
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)
|
||||
log: [error ][aot] Unable to map shared spaces
|
||||
|
||||
== the same files copied with plain cp (bytes and path layout identical, timestamps new)
|
||||
result: started, ready after 4013 ms (Started AotCacheApplication in 3.361 seconds)
|
||||
log: [warning][aot] This file is not the one used while building the AOT cache: 'app.jar', timestamp has changed
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)
|
||||
log: [error ][aot] Unable to map shared spaces
|
||||
|
||||
== the application directory was moved after training (same bytes, different path)
|
||||
result: started, ready after 2005 ms (Started AotCacheApplication in 1.542 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
== cache trained on the fat jar, run from the extracted layout
|
||||
result: started, ready after 3900 ms (Started AotCacheApplication in 3.262 seconds)
|
||||
log: [warning][aot] This file is not the one used while building the AOT cache: 'app.jar', size has changed
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)
|
||||
log: [error ][aot] Unable to map shared spaces
|
||||
|
||||
== JDK 25's cache used by JDK 27
|
||||
result: started, ready after 4221 ms (Started AotCacheApplication in 3.537 seconds)
|
||||
log: [warning][aot] The AOT cache version 0x13 does not match the required version 0x14.
|
||||
log: [warning][aot] The AOT cache has the wrong version.
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
log: [warning][aot] The AOT cache version 0x13 does not match the required version 0x14.
|
||||
|
||||
== the same, with -XX:AOTMode=on
|
||||
result: did not start (exit code 1)
|
||||
log: [warning][aot] The AOT cache version 0x13 does not match the required version 0x14.
|
||||
log: [warning][aot] The AOT cache has the wrong version.
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
log: [warning][aot] The AOT cache version 0x13 does not match the required version 0x14.
|
||||
|
||||
== -XX:+UseCompactObjectHeaders added at run time only (JDK 25)
|
||||
result: started, ready after 4138 ms (Started AotCacheApplication in 3.446 seconds)
|
||||
log: [warning][aot] Unable to use AOT cache.
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
log: [error ][aot] Unable to map shared spaces
|
||||
|
||||
== a different collector at run time: -XX:+UseSerialGC
|
||||
result: started, ready after 1916 ms (Started AotCacheApplication in 1.516 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
== a different collector at run time: -XX:+UseParallelGC
|
||||
result: started, ready after 1957 ms (Started AotCacheApplication in 1.473 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
== a different collector at run time: -XX:+UseZGC
|
||||
result: started, ready after 3981 ms (Started AotCacheApplication in 3.347 seconds)
|
||||
log: [warning][aot] Unable to use AOT cache.
|
||||
[ ] The saved state of UseCompressedOops and UseCompressedClassPointers is different from runtime, CDS will be disabled.
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
log: [error ][aot] Unable to map shared spaces
|
||||
|
||||
== a different heap size at run time: -Xmx256m
|
||||
result: started, ready after 2058 ms (Started AotCacheApplication in 1.602 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
== a cache file that does not exist
|
||||
result: started, ready after 4113 ms (Started AotCacheApplication in 3.451 seconds)
|
||||
log: [error][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error][aot] Loading static archive failed.
|
||||
log: [error][aot] Unable to map shared spaces
|
||||
|
||||
== a cache file that does not exist, with -XX:AOTMode=on
|
||||
result: did not start (exit code 1)
|
||||
log: [error][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error][aot] Loading static archive failed.
|
||||
log: [error][aot] Unable to map shared spaces
|
||||
|
||||
# and on JDK 27, whose cache was trained under the default collector (G1):
|
||||
|
||||
== JDK 27, cache from JDK 27 (control)
|
||||
result: started, ready after 1955 ms (Started AotCacheApplication in 1.547 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
== JDK 27, -XX:+UseZGC at run time
|
||||
result: started, ready after 4158 ms (Started AotCacheApplication in 3.502 seconds)
|
||||
log: [warning][aot] Unable to use AOT cache.
|
||||
[ ] The saved state of UseCompressedOops (1) is different from runtime (0), CDS will be disabled.
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
log: [error ][aot] Unable to map shared spaces
|
||||
|
||||
== JDK 27, -XX:+UseSerialGC at run time
|
||||
result: started, ready after 2103 ms (Started AotCacheApplication in 1.672 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
== JDK 27, -XX:-UseCompactObjectHeaders at run time
|
||||
result: started, ready after 3906 ms (Started AotCacheApplication in 3.163 seconds)
|
||||
log: [warning][aot] Unable to use AOT cache.
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
log: [warning][aot] Unable to use AOT cache.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
|
||||
# why ZGC is different: ask the JVM (-Xlog:aot=info) why it refused the G1-trained cache
|
||||
|
||||
== JDK 27, -XX:+UseZGC with the G1-trained cache, -Xlog:aot=info
|
||||
result: started, ready after 3885 ms (Started AotCacheApplication in 3.258 seconds)
|
||||
log: [info][aot] The AOT cache was created with UseCompressedOops = 1, UseCompactObjectHeaders = 1
|
||||
log: [warning][aot] Unable to use AOT cache.
|
||||
[ ] The saved state of UseCompressedOops (1) is different from runtime (0), CDS will be disabled.
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
|
||||
== JDK 27, cache trained under ZGC, run under ZGC
|
||||
result: started, ready after 1988 ms (Started AotCacheApplication in 1.554 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
== JDK 27, cache trained under ZGC, run under G1 (compressed oops on again)
|
||||
result: started, ready after 3869 ms (Started AotCacheApplication in 3.199 seconds)
|
||||
log: [warning][aot] Unable to use AOT cache.
|
||||
[ ] The saved state of UseCompressedOops (0) is different from runtime (1), CDS will be disabled.
|
||||
log: [error ][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
|
||||
log: [error ][aot] Loading static archive failed.
|
||||
log: [warning][aot] Unable to use AOT cache.
|
||||
|
||||
== JDK 27, cache trained under ZGC, run under G1 with -XX:-UseCompressedOops
|
||||
result: started, ready after 2018 ms (Started AotCacheApplication in 1.534 seconds)
|
||||
log: (nothing at warning or error level)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# java -Djarmode=tools -jar app.jar extract --layers (the layer order Spring Boot's Dockerfile support uses)
|
||||
layer KB gzip KB files
|
||||
dependencies 22878 20490 47
|
||||
spring-boot-loader 0 0 0
|
||||
snapshot-dependencies 0 0 0
|
||||
application 8 7 1
|
||||
|
||||
# the AOT cache from the training run (context-only), for scale
|
||||
refresh.aot 61016 15362
|
||||
|
||||
# change one line of application code (the unit price in OrderService, built by prepare.sh), extract again
|
||||
layer before after verdict
|
||||
dependencies 81a2cb4f9f5c 81a2cb4f9f5c identical: reused from cache/registry
|
||||
spring-boot-loader abcfa6a9d4df abcfa6a9d4df identical: reused from cache/registry
|
||||
snapshot-dependencies abcfa6a9d4df abcfa6a9d4df identical: reused from cache/registry
|
||||
application 4ecdea8230c6 19563974ba7b CHANGED: rebuilt and pushed
|
||||
AOT cache: trained against the previous jar, so it is stale for the new one (see output/04-mismatch.txt); it must be regenerated after the application layer
|
||||
@@ -0,0 +1,12 @@
|
||||
$ curl localhost:18110/ping
|
||||
ok [HTTP 200]
|
||||
$ curl -H 'Content-Type: application/json' -d '{"customer":"[email protected]","sku":"ABC-1234","quantity":3}' localhost:18110/orders
|
||||
{"id":1,"customer":"[email protected]","sku":"ABC-1234","quantity":3,"total":14.97,"createdAt":"2026-09-24T16:35:45.259486118Z"} [HTTP 201]
|
||||
$ curl localhost:18110/orders/1
|
||||
{"id":1,"customer":"[email protected]","sku":"ABC-1234","quantity":3,"total":14.97,"createdAt":"2026-09-24T16:35:45.259486118Z"} [HTTP 200]
|
||||
$ curl -H 'Content-Type: application/json' -d '{"customer":"bad","sku":"x","quantity":0}' localhost:18110/orders
|
||||
{"timestamp":"2026-09-24T16:35:45.351Z","status":400,"error":"Bad Request","path":"/orders"} [HTTP 400]
|
||||
$ curl localhost:18110/orders/99
|
||||
[HTTP 404]
|
||||
$ curl localhost:18110/actuator/health
|
||||
{"groups":["liveness","readiness"],"status":"UP"} [HTTP 200]
|
||||
Reference in New Issue
Block a user