Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Over the next five to ten years, should your organisation bet on HotSpot JIT, GraalVM Native Image, or a mix for its Java services? Explain the trade-offs you would weigh.

I would not bet the whole organisation on one runtime. HotSpot with its JIT stays the default for long-running services, because it gives the best peak throughput and supports every dynamic feature, while GraalVM Native Image is reserved for workloads where fast startup and small memory clearly pay, such as scale-to-zero functions and short-lived tools. Because Project Leyden is steadily improving startup inside HotSpot and a mix of runtimes adds build and test cost, we decide per workload type and revisit the decision as Leyden and the frameworks evolve.

Why this question is asked

A runtime decision for hundreds of services lasts for years and touches build pipelines, container images, testing, hiring and cloud cost. Native images promise millisecond startups and small memory, while HotSpot promises peak performance and no surprises with reflection-heavy frameworks. Interviewers ask this leadership question to see whether we can weigh technical trade-offs against organisational cost over a long horizon, and avoid both hype and inertia. In this answer, we will recap how the two runtimes work, compare what each costs and gives, look at how Leyden changes the picture, and then lay out the policy we would choose and how we would keep it current.

1A Quick Recap of the Two Runtimes

HotSpot is the JVM in standard OpenJDK builds. It loads bytecode at run time, starts in the interpreter, and its JIT compilers turn hot methods into optimized machine code using a profile of real traffic. Everything stays dynamic: classes can be loaded, generated and reflected on at any time.

GraalVM Native Image takes the opposite approach. At build time, it analyses the whole application from its entry point, assumes nothing else will ever be loaded, which is called the closed-world assumption, and compiles everything reachable into a standalone native executable. There is no JIT warm-up and no class loading at startup, so the process starts in tens of milliseconds and needs much less memory. But anything the analysis cannot see, such as classes used only through reflection, resources loaded by name, or proxies created at run time, must be declared in reachability metadata, or it is missing at run time.

2What Each Runtime Gives and Costs

For a long-running service that handles traffic all day, startup happens once per deployment, so a few seconds of warm-up matter little, and peak throughput matters a lot. HotSpot's C2 compiler, working from a live profile, usually produces faster steady-state code than ahead-of-time compilation, unless the native build uses profile-guided optimization, which needs an extra training build. HotSpot also supports every tool our engineers know: JFR, jcmd, Java agents, heap dumps and the usual profilers.

For workloads that start often and live briefly, the balance flips. A function that scales to zero and cold-starts on each burst of traffic, a command-line tool, or a job that runs for a few seconds pays the JVM's startup and warm-up every time. There, a native image that starts in 50 ms and uses 60 MB instead of 300 MB can cut latency and cloud cost substantially. The price is paid in the build: native builds take several minutes and gigabytes of memory, metadata must be maintained as libraries change, and some libraries are not ready for the closed world. Spring Boot's AOT processing generates much of the metadata, which helps, but every library upgrade needs a native test run.

HotSpot JIT versus Native Image
ConcernHotSpot JITNative Image
Startupseconds, then minutes of warm-uptens of milliseconds
Memoryhigher: JIT, metadata, code cachemuch lower resident memory
Peak throughputbest, from live profilesusually lower unless PGO is used
Dynamic featuresall: reflection, agents, class loadingneed reachability metadata
Buildfast javac and jarminutes and gigabytes per build
DiagnosticsJFR, jcmd, agents, heap dumpsreduced and different tooling
Figures are typical orders of magnitude; measure your own services.

3How Project Leyden Changes the Bet

The question is not static, because HotSpot itself is getting better at startup. Project Leyden is the OpenJDK effort to move work from run time to earlier phases while keeping Java dynamic. JDK 24 delivered an ahead-of-time cache that stores classes already loaded and linked from a training run, JDK 25 added stored method profiles so the JIT optimizes sooner, and later releases are expected to store compiled code too; check your version for what is available.

This matters for a five-to-ten-year decision. If HotSpot with an AOT cache gets most services to fast startup with full peak performance and no closed-world restrictions, the set of workloads that truly need a native image shrinks. We should also watch the GraalVM project itself, whose relationship with Oracle's Java releases and product plans has changed over time, before committing a large share of the fleet to it. A bet placed today on native images for everything could look expensive in three years; a bet that ignores native images could miss real savings for serverless workloads now.

4Why a Mix Is Not Free

Running both runtimes sounds like the obvious answer, and in the end it usually is, but we should see its cost clearly. Every library and shared component must be tested on both runtimes, because a change that adds reflection can break native builds while passing on HotSpot. CI needs native build capacity. Engineers need to know two sets of diagnostics, and incident runbooks need two versions. Security patching means rebuilding native executables, not just updating a base image.

So the mix should be deliberately narrow: a clear rule for which workloads may go native, a platform team that owns the native build tooling, and a small set of supported frameworks and libraries for native services.

5The Policy We Would Choose

We decide per workload type, not per team preference. Long-running services, which are the large majority, stay on HotSpot, and we adopt AppCDS and the Leyden AOT cache in the standard images to cut startup. Scale-to-zero functions, short-lived jobs and CLI tools may use Native Image when a measurement shows the benefit, for example cold start under a required threshold or a large memory saving across many instances.

We write the policy down with its review date, and we revisit it at each Java LTS release, with data: startup and memory of HotSpot with the AOT cache, native build times, incidents linked to either runtime, and cloud cost. If Leyden closes the gap, we let the native share shrink; if native tooling matures and our framework support improves, we widen it. Either way, the decision follows measurements, not enthusiasm.

Step throughChoosing a runtime for one workload
  1. Long-running service?
    YesHotSpot with CDS or AOT cacheNoCheck startup needs
  2. Cold start or memory critical?scale to zero, short jobs, CLI
    YesPrototype a native imageNoHotSpot
  3. Native build and tests pass with supported libraries?
    YesNative Image, owned toolingNoHotSpot
  4. Review at each LTScompare Leyden progress and costs

4 steps in order. Play them, or step through them one at a time.

6Follow-up questions

How would you measure whether native images are worth it for a function?

We would build both variants and measure cold-start latency at p50 and p99, memory per instance, throughput under steady load, and the cloud bill for a realistic traffic pattern, along with build time and the effort spent on metadata. If the native variant saves a meaningful share of cost or meets a latency target HotSpot cannot, and the build cost is acceptable, it wins for that workload.

Would you let a team choose Native Image for a normal REST service?

Only with a reason that survives measurement, such as running hundreds of small instances where memory dominates cost. For a typical service running all day, HotSpot gives better peak throughput and fewer surprises, and an AOT cache addresses most of the startup complaint. The team would also need to accept the build and testing costs.

What is the biggest risk in betting fully on HotSpot?

Missing savings in workloads that start very often, where JVM startup is a real cost, and being slow to adopt improvements if we never measure the alternatives. That is why the policy keeps a narrow, owned path for native images and reviews the numbers regularly.

7Conclusion

In this answer, we saw that HotSpot's JIT gives the best peak throughput and full dynamic features for long-running services, while Native Image gives fast startup and low memory at the cost of closed-world restrictions and heavy builds. Leyden is narrowing the startup gap inside HotSpot, and a mix of runtimes has real costs, so the sound policy is HotSpot by default, native images for workloads that measurably need them, and a review at each LTS.

What to say in the interviewAbout 80 seconds aloud

Open with

I would not make an all-or-nothing bet. For long-running services, which is most of our fleet, HotSpot is the right default: the JIT uses live profiles to reach the best peak throughput, every dynamic feature works, and our engineers already know JFR, jcmd and the agents.

Then, if they want more

Native Image is compelling where startup and memory dominate, like scale-to-zero functions, short jobs and CLI tools, because it starts in tens of milliseconds and uses a fraction of the memory. But it relies on a closed-world analysis, so reflection and resources need reachability metadata, builds take minutes and lots of memory, and every library upgrade needs native testing.

I would also factor in Project Leyden: JDK 24's ahead-of-time cache and the profile storage in 25 are already improving HotSpot startup, and if that continues, fewer workloads will need native images. And a mix is not free, because shared libraries must be tested on both and we need two sets of runbooks.

So my policy would be HotSpot with CDS or the AOT cache by default, native images only for workload types where a measurement shows a clear benefit, with a platform team owning that tooling, and a review at every LTS release using startup, memory, cost and incident data.

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.
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 "Over the next five to ten years, should your organisation bet on HotSpot JIT, GraalVM...": https://scrivio-interview-library.netlify.app/java/jvm-architecture/3416fb99ae/