Java Forum Stuttgart 2025: "Wie kann ich Java schneller starten – und wann lohnt sich das?"
Summary
Starting Java faster could be worthwhile if you used serverless computing (such as AWS Lambda), ran many services, or needed very high availability. By design, Java used more time, more CPU, and more memory to start up.
There were four ways to make Java start faster:
- Spring Boot tuning
- Class Data Sharing (CDS) and Project Leyden
- Project CRaC
- GraalVM Native Image
See my slides below for why I reached this conclusion.
Logistics
Conference
Java Forum Stuttgart 2025 was one of the largest Java conferences in Germany. It took place on July 10, 2025.
Talk
My talk took place on July 10, 2025, at 9:50.
Abstract
This is how Java applications can start faster – sorted by ascending speed gains: Framework tuning, Class Data Sharing (CDS), Project Leyden/JEP 483 (from Java 24 onward), CRaC, and GraalVM Native Image. However: The faster the startup, the greater the effort and limitations. This can be worthwhile because application uptime increases, the number of standby instances decreases, or serverless computing becomes cheaper.
The talk demonstrates all options using a Spring Boot example project, explains pros and cons, and provides guidance for cost-benefit calculations.
Who Made Me the Expert?
In the spring of 2022, I was the editor of a six-part article series about native Java on InfoQ. I wrote several articles about Project Leyden, CRaC, and GraalVM Native Image myself, and I gave talks about them, too.
Slides
The slides were available as a PDF (0.4 MB). They had more content and more text than my talking slides.
Historical note (as of July 2025): Back then, the slides were also available in their original Keynote format (6 MB) — with less text, but animated and with speaker notes; that file is no longer available today.
Benchmark Repo
All the code for these benchmarks lives in a public GitHub repository: ksilz/spring-petclinic.
Usage
The repo is a fork of the official Spring PetClinic project. I added shell scripts for building (compile-and-run.sh) and for training/benchmark runs (benchmark.sh), plus a small library for CRaC. The scripts are only tested on Linux and macOS.
You could run the six benchmarks with ./compile-and-run.sh [scenario], where scenario is one of these:
baseline: plain Spring Boot, option 0 in the talk. Needs JDK 21.tuning: Spring Boot tuning, option 1 in the talk. Needs JDK 21.cds: Class Data Sharing, part of option 2 in the talk. Needs JDK 21.leyden: Project Leyden, part of option 2 in the talk. Needs a pre-release version of JDK 25.crac: Project CRaC, option 3 in the talk. Needs JDK 24 from Azul with CRaC support, Linux only.graalvm: GraalVM Native Image, option 4 in the talk. Needs the GraalVM Oracle JDK 24 and a lot of memory — 16 GB wasn’t enough.
Measuring Startup Time and Memory
The benchmark script runs three warmup rounds, then seven benchmark rounds. It discards the fastest and slowest run and averages the remaining five.
Startup time was measured in two ways:
- For CRaC, the script looked for
restored JVM running for X msin the Spring Boot log. - For all other scenarios, it looked for
Started PetClinicApplication in X.XXX seconds.
Memory consumption was measured by running the benchmarked application through /usr/bin/time and reading the memory from the output:
- macOS: reads “peak memory footprint” from
/usr/bin/time -l. - Linux: reads “Maximum resident set size” from
/usr/bin/time -v.
Internally, the script converts both to KB for consistency but displays the result in MB.
Notes
- I created the scripts with the AI IDE Cursor. That may explain some rough edges in the script.
- I originally planned to add Maven build commands as well. The skeleton for that is still in the repo, but it doesn’t work.
- The CRaC part didn’t always work reliably: at one point, it created a snapshot where the application shut down right after loading it.
Additional Talk Information
The six-part article series about native Java on InfoQ from 2022 is the foundation for a lot of what’s in this talk — I edited it, but didn’t write it myself. You can find my other articles and news items on InfoQ on my profile page.
Is It Worth It?
When is faster startup worth the effort?
AWS Lambda SnapStart is a good example of a scenario where fast startup pays off directly: it reduces cold-start latency for serverless functions. On the other end of the spectrum, Apple’s migration of parts of its password system from Java to Swift shows how much the cost of a slower-starting runtime can weigh on a decision.
A sample return-on-investment calculation
Take a microservice Java application running on Kubernetes that wants to cut operational costs by switching to GraalVM Native Image. The idea: lower memory consumption means more pods fit on each node, which means fewer servers are needed overall.
Assumptions: the application runs on Kubernetes on Linux on Amazon EC2 T3.2XLarge servers (32 GB RAM, 8 CPUs) at 280 EUR/month, or 10,080 EUR over 36 months. Developers work on macOS and debug production issues inside Linux containers. Developer/admin time costs 100 EUR/hour. The investment needs a positive ROI after three years.
Labor costs: a one-time introduction effort (build and deployment changes, training) of 120 hours, or 12,000 EUR; ongoing maintenance of 4 hours per month over 30 months, another 120 hours or 12,000 EUR; upgrades every six months (Spring Boot, GraalVM) at 16 hours each, five times, or 80 hours and 8,000 EUR; and productivity loss from debugging native executables in production, 4 hours per month over 35 months, or 140 hours and 14,000 EUR. Total labor cost over three years: 46,000 EUR.
Operational costs: one additional EC2 T3.2XLarge build server, 10,080 EUR.
Total cost: 56,080 EUR.
For a positive ROI, GraalVM Native Image needs to reduce the number of EC2 T3.2XLarge servers by at least six — six servers saved is 60,480 EUR, a net saving of 4,400 EUR over three years.
How to Go Faster?
Spring Boot tuning
Two building blocks do most of the work here: Spring AOT and JAR extraction, both described well in this Baeldung article on Spring 6 ahead-of-time optimizations. At the time of the talk, a few relevant Spring tickets were still open: spring-cloud-stream#3118, spring-statemachine#1080, and spring-boot#37101.
Class Data Sharing and Project Leyden
Spring documents Class Data Sharing directly in its how-to guides. Project Leyden shipped its first pieces in JDK 24 — I wrote about that for InfoQ. The relevant JEPs are 483, 514, 515, and 516, plus the draft JEP 8335368.
Project CRaC
Project CRaC checkpoints a running JVM and restores it almost instantly. Oracle’s Brian Goetz discusses it in this talk. You need a JDK with CRaC support to use it — Azul’s OpenJDK build or BellSoft’s Liberica JDK both offer one. Several frameworks already support CRaC out of the box: Spring Boot 3.2, Quarkus 2.10.0, Micronaut 3.7, and Helidon 4.2.
GraalVM Native Image
GraalVM Native Image compiles a Java application ahead of time into a native executable; Spring Boot has its own documentation for it. Frameworks like Spring Boot typically ship the Native Image configuration their libraries need (Spring Security, Spring Data, and so on), and the GraalVM Reachability Metadata Repository fills in more of it automatically. Some things are simply impossible with Native Image: creating new classes or methods at runtime, executing new bytecode, exotic classloader tricks, and Java agents (for example, for observability). A few things only partially work: AWT and JavaFX (not on macOS), JMX, many Java Flight Recorder data points, and some testing frameworks. And some things — reflection, explicit class loading — need extra configuration to work at all.