Add graalvm-native-images: Boot 4.1 + GraalVM CE for JDK 25, AOT processing,
the tracing agent, and a real reflection-collision trap Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EQNA6DJ9VgCtW6zhCE8Xud
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
$ export JAVA_HOME=/opt/jdk25 && java -jar target/app.jar --server.port=8081
|
||||
Starting GraalvmDemoApplication v1.0.0 using Java 25.0.4.1 with PID 796 (/tmp/sbd-work/spring-boot-demo/graalvm-native-images/target/app.jar started by root in /tmp/sbd-work/spring-boot-demo/graalvm-native-images)
|
||||
Tomcat started on port 8081 (http) with context path '/'
|
||||
Started GraalvmDemoApplication in 3.472 seconds (process running for 4.041)
|
||||
|
||||
$ ps -o rss= -p 796
|
||||
195356
|
||||
@@ -0,0 +1,18 @@
|
||||
$ export JAVA_HOME=/opt/graalvm25 && mvn -Pnative -DskipTests native:compile
|
||||
[2/8] Performing analysis... [*****] (94.1s @ 2.35GB)
|
||||
20,126 types, 29,154 fields, and 91,938 methods found reachable
|
||||
7,495 types, 4,032 fields, and 16,651 methods registered for reflection
|
||||
68 types, 71 fields, and 58 methods registered for JNI access
|
||||
0 downcalls and 0 upcalls registered for foreign access
|
||||
4 native libraries: dl, pthread, rt, z
|
||||
[6/8] Compiling methods... [**********] (99.2s @ 2.18GB)
|
||||
30.4s (11.7% of total time) in 1838 GCs | Peak RSS: 4.36GB | CPU load: 1.87
|
||||
Build artifacts:
|
||||
/tmp/sbd-work/spring-boot-demo/graalvm-native-images/target/graalvm-native-images (executable)
|
||||
Finished generating 'graalvm-native-images' in 4m 19s.
|
||||
[INFO] BUILD SUCCESS
|
||||
[INFO] Total time: 04:31 min
|
||||
|
||||
$ ls -lh target/graalvm-native-images target/app.jar
|
||||
-rwxr-xr-x 1 root root 93M Sep 20 10:35 target/graalvm-native-images
|
||||
-rw-r--r-- 1 root root 22M Sep 20 10:31 target/app.jar
|
||||
@@ -0,0 +1,13 @@
|
||||
$ ./target/graalvm-native-images --server.port=8082
|
||||
Starting AOT-processed GraalvmDemoApplication using Java 25.0.2 with PID 1234 (/tmp/sbd-work/spring-boot-demo/graalvm-native-images/target/graalvm-native-images started by root in /tmp/sbd-work/spring-boot-demo/graalvm-native-images)
|
||||
Tomcat started on port 8082 (http) with context path '/'
|
||||
Started GraalvmDemoApplication in 0.091 seconds (process running for 0.097)
|
||||
|
||||
$ ps -o rss= -p 1234
|
||||
107984
|
||||
|
||||
$ curl -s "localhost:8082/report?format=plain"
|
||||
REFLECTION-FAILED class=com.ankurm.graalvmdemo.report.PlainTextReport exception=java.lang.ClassNotFoundException message=com.ankurm.graalvmdemo.report.PlainTextReport
|
||||
|
||||
$ curl -s "localhost:8082/report?format=json"
|
||||
REFLECTION-FAILED class=com.ankurm.graalvmdemo.report.JsonReport exception=java.lang.ClassNotFoundException message=com.ankurm.graalvmdemo.report.JsonReport
|
||||
@@ -0,0 +1,17 @@
|
||||
$ /opt/graalvm25/bin/java -agentlib:native-image-agent=config-output-dir=agent-output -jar target/app.jar --server.port=8083
|
||||
Started GraalvmDemoApplication in 5.552 seconds (process running for 6.51)
|
||||
|
||||
$ curl -s localhost:8083/hello
|
||||
Hello from a GraalVM native image!
|
||||
$ curl -s "localhost:8083/report?format=plain"
|
||||
OK via reflection on com.ankurm.graalvmdemo.report.PlainTextReport: REPORT: quarterly numbers
|
||||
$ curl -s "localhost:8083/report?format=json"
|
||||
OK via reflection on com.ankurm.graalvmdemo.report.JsonReport: {"report":"quarterly numbers"}
|
||||
|
||||
$ grep -A4 '"com.ankurm.graalvmdemo.report.PlainTextReport"' agent-output/reachability-metadata.json
|
||||
{
|
||||
"type": "com.ankurm.graalvmdemo.report.PlainTextReport",
|
||||
"methods": [
|
||||
{ "name": "<init>", "parameterTypes": [] }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
$ ./target/graalvm-native-images --server.port=8085
|
||||
Started GraalvmDemoApplication in 0.104 seconds (process running for 0.111)
|
||||
|
||||
$ curl -s "localhost:8085/report?format=plain"
|
||||
OK via reflection on com.ankurm.graalvmdemo.report.PlainTextReport: REPORT: quarterly numbers
|
||||
$ curl -s "localhost:8085/report?format=json"
|
||||
OK via reflection on com.ankurm.graalvmdemo.report.JsonReport: {"report":"quarterly numbers"}
|
||||
|
||||
$ ps -o rss= -p <pid>
|
||||
108120
|
||||
@@ -0,0 +1,12 @@
|
||||
$ mvn -Pnative -DskipTests package
|
||||
[INFO] --- native:1.1.8:add-reachability-metadata (add-reachability-metadata) @ graalvm-native-images ---
|
||||
[INFO] --- resources:3.5.0:resources (default-resources) @ graalvm-native-images ---
|
||||
[INFO] --- compiler:3.15.0:compile (default-compile) @ graalvm-native-images ---
|
||||
[INFO] --- spring-boot:4.1.1:process-aot (process-aot) @ graalvm-native-images ---
|
||||
[INFO] --- jar:3.5.1:jar (default-jar) @ graalvm-native-images ---
|
||||
[INFO] --- spring-boot:4.1.1:repackage (repackage) @ graalvm-native-images ---
|
||||
[INFO] BUILD SUCCESS
|
||||
[INFO] Total time: 8.791 s
|
||||
# No native-image invocation anywhere in this log -- confirmed by grepping the full log for
|
||||
# "native-image" and "Generating '": zero matches. Only "mvn -Pnative native:compile" (run
|
||||
# separately, see 02-native-build.txt) actually invokes the GraalVM compiler.
|
||||
Reference in New Issue
Block a user