Why architecture matters here

GraalVM architecture matters because AOT compilation changes Java's economics for cold-start-sensitive workloads. Instant startup (~30ms) + low memory (~50-100 MB) makes Java competitive with Go for serverless. But peak throughput can be lower than JIT-compiled JVM.

Cost is engineering — reflection config, framework compatibility. Frameworks like Micronaut and Quarkus greatly reduce this.

Reliability of AOT-compiled apps is high — no JIT warmup surprises.

Advertisement

The architecture: every piece explained

Walk the diagram top to bottom.

Java code. Standard bytecode; but must be AOT-compatible (limited reflection etc).

GraalVM Compiler. Advanced JIT + AOT compiler; often produces better optimized code than HotSpot's C2.

Native Image. AOT compiles to standalone executable. No JVM at runtime.

Instant startup. Millisecond boot; no class loading, no JIT warmup.

Low memory. 10-30% of JVM footprint typically. No JIT compiler in memory.

Reflection config. AOT can't discover reflection at runtime; must be listed in config. Tracing agent helps generate.

Truffle framework. Language implementation framework — Python, Ruby, JS all run on Graal via Truffle.

Serverless fit. Lambda cold starts drop from seconds to milliseconds.

Peak throughput. Sometimes less than JIT — HotSpot has decades of optimizations.

Frameworks. Micronaut + Quarkus designed for AOT; Spring Boot 3 supports.

Java codestandard bytecodeGraalVM Compileradvanced JITNative ImageAOT compiledInstant startupno JIT warmupLow memory10-30% of JVMReflection configAOT can't discoverTruffle frameworkpolyglotServerless fitLambda / Cloud RunPeak throughputsometimes less than JITFrameworksMicronaut, Quarkus, Spring Boot 3+Oracle Labs + community: mature but not always faster than HotSpot
GraalVM: Java code + GraalVM compiler + Native Image AOT; instant startup + low memory; reflection config + Truffle polyglot; framework support.
Advertisement

End-to-end Native Image build + run

Trace a build. Java app using Quarkus. Build with `mvn package -Pnative`. GraalVM Native Image starts.

Classpath analysis: which classes reachable? Only reachable ones compiled.

Reflection config consulted: which reflective accesses to support? Compile those hooks.

Native compilation: converts bytecode to machine code; embeds runtime (garbage collector, etc.).

Output: 60 MB executable, no JVM needed to run.

Deploy to Lambda. Cold start: 40ms vs 2s for JIT JVM. Warm invocation: comparable or slightly slower than JIT.

Alternative: Spring Boot 3. Similar but needs more reflection config initially. Tracing agent runs app under HotSpot with agent that logs reflection uses; config generated; native build with that config.

Peak throughput: benchmarks against JIT show native is 80-95% of peak; sometimes even better.