Quick revision
The short answer
I would start by asking what problem the standard is meant to solve, whether cost, startup or density, and measure it on our real workloads. Native images help a lot for some services and little for others, they bring ecosystem and build costs, and the JDK's own AOT work in Project Leyden is narrowing the gap without closed-world limits. So I would make native a supported option for services that clearly benefit, not a mandate, and review the decision as the JDK and GraalVM evolve.
What to remember
In this answer, we saw that the decision to standardise on native images should start from the goal, cost, startup or density, measured on real workloads. Native images bring real gains but also closed-world metadata, longer builds, different tooling and training, while the JDK's AOT cache is narrowing the gap without those limits. The sensible bet is option-based: a JVM default with the AOT cache, native where the numbers clearly justify it, and a review at each JDK release so the decision can follow the evidence.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would start by asking what problem the standard is meant to solve, whether cost, startup or density, and measure it on our real workloads. Native images help a lot for some services and little for others, they bring ecosystem and build costs, and the JDK's own AOT work in Project Leyden is narrowing the gap without closed-world limits. So I would make native a supported option for services that clearly benefit, not a mandate, and review the decision as the JDK and GraalVM evolve.
Why this question is asked
Standardising on a technology is one of the most expensive decisions a platform group can make, because every new service inherits it and undoing it later means touching all of them. Native images are attractive: fast startup and small memory footprints look great on a slide. Interviewers ask this question to see whether a senior leader can separate the appeal of a technology from the problem the organisation actually has, and whether they can keep a decision reversible while the field is still moving. In this answer, we will clarify the goal, look at how to measure it, weigh the ecosystem and build costs, compare a mandate with an option-based approach, and set up a way to review the decision.
1Start With the Goal, Not the Technology
Before discussing native images at all, I would ask the people pushing the standard what they want to improve. The first is cloud cost: fewer gigabytes and CPU cores for the same traffic. The second is startup time: services that must scale out within seconds, or that start per request like functions. The third is density: fitting more services on each node, which matters most for many small, mostly idle services.
These goals lead to different answers. A service with 6 replicas that runs all day has little to gain from fast startup, and its memory savings may be a few gigabytes. A batch job that starts 2,000 times a day, or a service that scales from 2 to 200 pods during a spike, can gain a great deal. A native image, a Java program compiled ahead of time into a standalone executable by GraalVM, mainly improves startup and footprint; it does not automatically improve throughput, and a warmed-up JIT can still be faster at peak.
2Measure It on Real Workloads
Next, I would ask for measurements on three or four representative services rather than on a hello-world sample. The comparison should include the plain JVM, the JVM with the AOT cache, and a native image, using production-like traffic. We would record startup to readiness, memory at steady state, throughput and p99 latency under load, build time, and image size.
Notice what such a table usually shows: native wins clearly on readiness and memory, the AOT cache wins half of the startup gap for almost no work, and native may lose a little at p99 under sustained load unless we use profile-guided optimisation. Those numbers, multiplied by the replica count and the price per gigabyte, tell us whether the goal is worth the cost for each service.
3Weighing Ecosystem and Build Costs
Native images work under a closed-world assumption: everything the program will use must be visible at build time. Reflection, dynamic proxies, resources and serialisation all need reachability metadata, which Spring Boot's AOT processing and the shared GraalVM metadata repository provide for many libraries, but not all. Every library upgrade can break a native build in a way that only shows up at runtime, so somebody must own that work.
Build infrastructure grows too. A native build can take several minutes and need several gigabytes of memory, which across hundreds of builds per day means more CI runners. Observability changes as well, because Java agents that instrument bytecode at runtime do not run in a native image, so teams must switch to library-based instrumentation.
| Area | Cost under a native mandate |
|---|---|
| Libraries | Reachability metadata for reflection, proxies and resources |
| CI | Builds of several minutes and GBs of memory per service |
| Observability | No runtime Java agents; library instrumentation instead |
| Operations | New tools for profiling, dumps and debugging |
| People | Training and a team to own native build failures |
4The Moving Landscape: Leyden Narrows the Gap
The choice is not frozen. OpenJDK's Project Leyden is bringing ahead-of-time work into the normal JVM. Its AOT cache, first delivered in JDK 24 and extended in JDK 25 (check your version for details), records what a training run loaded and linked and reuses it at startup. It keeps full Java semantics, so reflection, agents and the JIT all keep working. The gains are smaller than native today, but each release adds more.
This matters for a standard because a mandate made today assumes the gap stays as large as it is now. If the JDK closes much of it in two or three years, an organisation that converted every service would be carrying the closed-world costs for a shrinking benefit.
5Choosing an Option-Based Approach
So I would prefer options to a mandate. The golden path, the default templates and pipelines new services start from, supports both a JVM build with the AOT cache and a native build. The JVM path is the default. A team chooses native when its numbers show a clear payoff, for example scale-to-zero services, short-lived jobs, command-line tools, or services with hundreds of replicas where memory dominates cost. The platform provides native templates, CI capacity and guidance, and the team owns its metadata.
Finally, I would write the decision down with its review dates. At each JDK LTS release, or yearly, we look at fleet data: how many services are native, what they saved, how many incidents came from native builds, and how far the AOT cache has come. That turns the debate into a decision we can revisit calmly rather than a fight every quarter.
- Name the goalCost, startup or density
- Measure JVM, AOT cache and nativeOn 3 or 4 real services
- Price ecosystem and build costsMetadata, CI, observability, training
- Clear payoff for this kind of service?YesOffer native in the golden pathNoDefault to JVM with AOT cache
- Review at each JDK LTSFleet data decides the next step
5 steps in order. Play them, or step through them one at a time.
A standard that can change with evidence.
6Follow-up questions
What if leadership insists on one standard for simplicity?
I would agree that simplicity matters and show that the option approach is still simple: one default path for everyone, plus one supported alternative with clear entry criteria. I would also show the numbers, including the yearly cost of metadata, CI and training under a mandate, so the trade-off is visible. Most leaders accept a default with a documented exception once they see that the mandate's cost lands on every team, including the ones that gain nothing.
Which services are poor candidates for native images?
Long-running services with few replicas and steady traffic gain little from faster startup, and services that rely heavily on reflection, dynamic class loading, bytecode generation or Java agents pay a high compatibility cost. Services where peak throughput matters most may also prefer the JIT. For them the AOT cache is the better choice.
How do you avoid a split where native services are second-class?
By making the platform responsible for both paths. Native services get the same dashboards, logs and alerts through library-based instrumentation, the same deployment templates, and clear support from the platform team. The difference should be in how the binary is built, not in how well the service is operated.
7Conclusion
In this answer, we saw that the decision to standardise on native images should start from the goal, cost, startup or density, measured on real workloads. Native images bring real gains but also closed-world metadata, longer builds, different tooling and training, while the JDK's AOT cache is narrowing the gap without those limits. The sensible bet is option-based: a JVM default with the AOT cache, native where the numbers clearly justify it, and a review at each JDK release so the decision can follow the evidence.
Open with
Before deciding, I would ask what we are trying to improve, because cost, startup time and density lead to different answers. Then I would measure three or four real services in three modes, plain JVM, JVM with the AOT cache, and native image, under production-like load, looking at time to ready, steady memory, p99 latency, throughput and build time.
Then, if they want more
Native usually wins big on startup and memory, but that comes with costs a mandate would spread to every team: reachability metadata for reflection and proxies, builds that take minutes and lots of memory, no runtime Java agents for observability, and different debugging tools.
I would also point out that the landscape is moving: Project Leyden's AOT cache in JDK 24 and 25 already gives a good part of the startup gain while keeping full JVM behaviour, and it keeps improving. So I would not mandate native for all new services.
I would make the JVM with the AOT cache the default in the golden path and offer native as a supported option for services that clearly benefit, such as scale-to-zero services, short jobs or services with hundreds of replicas. Teams that choose native own their metadata, and the platform supports them with templates and CI capacity.
And I would write down review points at each JDK LTS release, so we revisit the decision with fleet data instead of opinions.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 24, Java 25
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Kubernetes documentation, Spring Boot reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "The engineering organisation is debating whether to standardise all new Java services on...": https://scrivio-interview-library.netlify.app/spring-boot/native-and-aot/828b2a1e27/