Skip to content

JAX 2026: "Wie kann ich Java schneller starten – und wann lohnt sich das?"

Published on · 6 min read
Race cars labeled CDS and GraalVM on a race track

Share

Summary

Starting Java faster can be worthwhile if you use serverless computing (such as AWS Lambda), run many services, or need very high availability. By design, Java uses more time, more CPU, and more memory to start up.

There are 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

I gave the talk at JAX 2026.

Talk

My talk is described here. There’s also a post about the talk on the atra.consulting blog.

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 are available as a PDF (0.6 MB):

Download slides (PDF)

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.

Run benchmarks with ./compile-and-run.sh [scenario]:

  • baseline: plain Spring Boot, option 0. Needs JDK 25.
  • tuning: Spring Boot tuning, option 1. Needs JDK 25.
  • cds: Class Data Sharing, part of option 2. Needs JDK 25.
  • leyden: Project Leyden, part of option 2. Needs JDK 25.
  • crac: Project CRaC, option 3. Needs JDK 25 from Azul with CRaC support, Linux only.
  • graalvm: GraalVM Native Image, option 4. Needs the GraalVM Oracle JDK 25 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.

For startup time, the script looks for restored JVM running for X ms in the Spring Boot log for CRaC, and for Started PetClinicApplication in X.XXX seconds for all other scenarios.

For memory, it measures via /usr/bin/time: macOS reports “peak memory footprint” from /usr/bin/time -l, Linux reports “Maximum resident set size” from /usr/bin/time -v. Internally, the script converts both to KB and displays the result in MB.

Notes

I created the scripts with the AI IDE Cursor and then updated them with Claude Code — that may explain some rough edges.

I originally planned to add Maven build commands as well. The skeleton for that is still in the repo, but it doesn’t work.

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.