-
Notifications
You must be signed in to change notification settings - Fork 7
[SPIKE] Investigate GraalVM Native Image for native binary deployment #308
Copy link
Copy link
Open
Labels
containersPull requests that update containers codePull requests that update containers codeenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersjavaPull requests that update Java codePull requests that update Java codeplanningEnables automatic issue planning with CodeRabbitEnables automatic issue planning with CodeRabbitpriority lowNice-to-have improvement. Can be deferred without blocking other work.Nice-to-have improvement. Can be deferred without blocking other work.
Metadata
Metadata
Assignees
Labels
containersPull requests that update containers codePull requests that update containers codeenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersjavaPull requests that update Java codePull requests that update Java codeplanningEnables automatic issue planning with CodeRabbitEnables automatic issue planning with CodeRabbitpriority lowNice-to-have improvement. Can be deferred without blocking other work.Nice-to-have improvement. Can be deferred without blocking other work.
Problem
Even after reducing the runtime image via
jlink, Java still ships a JVM — interpreter, JIT compiler, garbage collector — that Go and Rust avoid entirely by compiling to native binaries. This structural difference means Java will always be heavier than Go and Rust at runtime, regardless of JRE trimming.Proposed Solution
Investigate whether Spring Boot's GraalVM Native Image support can produce a self-contained native binary for this application, eliminating the JVM from the runtime image entirely — similar to how Go and Rust deploy.
This is a research/spike issue, not a commitment to ship. The outcome should be a documented recommendation: proceed, defer, or reject, with justification.
Context
spring-boot-starter-aotand the native build tools Maven pluginreflect-config.jsonhint files; Spring Boot's AOT engine generates most of these automatically, but edge cases existSuggested Approach
1. Assess AOT compatibility
Run the GraalVM Native Image build locally:
Document any
MissingResourceConfigurationExceptionor reflection errors.2. Evaluate runtime image options if native build succeeds
A native binary can deploy on:
FROM scratch— smallest possible, no OS layerFROM gcr.io/distroless/static:nonroot— includes ca-certs, non-root userFROM alpine:3.23— familiar base, adds ~8 MB, retains shell for debugging3. Document trade-offs
4. Acceptance criteria for proceeding
The investigation should answer:
./mvnw -Pnative native:compilesucceed without manual hint files?Acceptance Criteria (for this spike)
References