Scrivio Interview library
LeadershipPrincipal5 min read · updated 12 November 2026

Startup time mattered little when apps were deployed a few times a year, and much more with containers and autoscaling. How has this changed the way you would choose a Java framework and runtime for the next five years?

Containers and autoscaling turned startup time and memory footprint into real costs, because short-lived and elastic workloads pay them on every scale-out. I would still choose per workload rather than switch frameworks wholesale: Spring has narrowed the gap with AOT processing, native image support and CDS, and JDK work under Project Leyden improves startup without changing the programming model. To keep options open, I would avoid heavy reflection and dynamic classpath tricks in our own code.

Why this question is asked

For years a Java service started once after a deploy and ran for weeks, so a 30 second startup cost almost nothing. Today a service may start dozens of times a day as pods scale with traffic, and a function may start for every burst of requests. That changes how we should judge a framework and runtime. Interviewers ask this of senior architects to hear a reasoned, durable position rather than enthusiasm for the newest option. In this answer, we will look at what changed and what it costs, the options Spring and the JDK now offer, how to decide per workload, and how to keep our code ready for whichever path we take.

1What Containers and Autoscaling Changed

Startup time now shows up in three places. Scaling out: when traffic doubles, new pods help only after they are ready, so a 40 second startup means 40 seconds of overload. Rollouts: rolling 30 pods with a 40 second startup and readiness checks takes many minutes, and slow rollouts make teams deploy less often. And cost: a service that cannot start quickly has to keep spare instances running all the time to absorb spikes, which we pay for every hour.

Memory footprint matters for similar reasons. A JVM service that needs 1 GB per pod fits fewer pods per node than one that needs 300 MB. For long-running services this is a modest cost; for workloads that scale to zero and back, startup and footprint can dominate the bill.

2What Spring and the JDK Now Offer

The gap with frameworks designed for fast startup, such as Quarkus and Micronaut, has narrowed. Spring Framework 6 and Boot 3 added AOT processing, which analyses the application at build time and generates code for bean definitions, so less work happens at startup. On top of AOT, GraalVM native image compiles the whole application to a native executable that starts in tens of milliseconds, at the price of long builds and limits on reflection and dynamic behaviour.

For the normal JVM, Boot supports class data sharing, CDS, which stores parsed classes from a training run so later starts load them faster, and Project Leyden in the JDK extends that idea with ahead-of-time class loading and linking, starting with JDK 24, and more AOT features in JDK 25; check your JDK version for exactly what is available. The attraction of these JVM options is that the code and programming model stay the same.

Startup options for a Spring service (rough, illustrative numbers)
OptionTypical startupMain cost
Plain JVM5 to 30 sSlow scale-out, more spare capacity
JVM + CDS / Leyden AOT cacheoften 30 to 50% fasterTraining run in the build
Spring AOT on the JVMmodest gainBuild step, fixed bean wiring
GraalVM native imagewell under 1 sLong builds, reflection limits, lower peak tuning
CRaC checkpoint/restoreunder 1 sLinux only, secrets and state in snapshot
Numbers vary widely by application; measure your own services.

3Deciding Per Workload

The mistake would be one rule for everything. A long-running order service with steady traffic and three pods gains little from native image; its startup happens a few times a day and its JIT-optimised peak throughput matters more. A function behind an event trigger, or a service that scales from 2 to 40 pods during a daily spike, gains a lot.

So I would classify workloads by how often they start and how fast they must react. Steady services stay on the JVM with CDS or Leyden caching as cheap wins. Spiky services get the JVM options first and native image if those are not enough. Functions and scale-to-zero workloads are the natural place for native image, or for a framework built for it, if the team accepts the build and testing cost. Each choice is backed by measurements on a real service, not benchmarks of hello-world applications.

Step throughChoosing a startup strategy per workload
  1. How often does it start?
    YesMany times per hour: spiky or functionNoA few times a day: steady
  2. Steady serviceJVM, add CDS or Leyden cache
  3. Spiky serviceJVM caches first, measure scale-out
  4. Still too slow?
    YesNative image for this serviceNoStay on JVM

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

4Keeping Options Open in Our Own Code

The technologies will keep changing over five years, so the most durable decision is about our own code. Native image and AOT both work by knowing at build time what the application will do. Code that builds class names from strings, loads plugins from the classpath at runtime, creates proxies by hand or relies on reflection without hints makes every one of these options harder.

So the principle I would set is simple: prefer plain constructor injection and explicit configuration, register runtime hints where reflection is truly needed, avoid conditional beans that depend on runtime state, and run an AOT or native build of key services in CI even before we use it in production. Then moving a workload to a faster startup option later is a configuration change, not a rewrite.

5Follow-up questions

Would you move the whole estate to native image?

No. Native image costs build time, needs reachability metadata for reflection, and usually gives lower peak throughput than a warmed-up JIT. I would use it where frequent startup dominates, and keep steady services on the JVM with cheaper caching options.

Is it worth switching to Quarkus or Micronaut for startup alone?

For new, isolated workloads with strict startup needs, it can be. For an estate built on Spring, the switching cost in skills, libraries and platform starters is large, and Spring's AOT and native support cover most needs. I would decide per workload with measurements.

How do you measure whether startup improvements matter?

Track time to ready in production, rollout duration and how much spare capacity autoscaling needs. If a change cuts time to ready from 30 to 8 seconds and lets us lower the minimum replica count, that is a measurable saving.

6Conclusion

In this answer, we saw that containers and autoscaling made startup time and footprint real costs through slow scale-out, slow rollouts and spare capacity. Spring narrowed the gap with AOT, native image support and CDS, and JDK work such as Project Leyden improves startup without changing the programming model. The durable approach is to decide per workload, using measurements, and to keep options open by avoiding heavy reflection and dynamic classpath tricks in our own code.

What to say in the interviewAbout 80 seconds aloud

Open with

When services started a few times a year, startup time did not matter. With containers and autoscaling it matters in three ways: new pods only help after they are ready, so slow startup means overload during spikes; rollouts take longer, so teams deploy less; and we keep spare instances running to cover the gap.

Then, if they want more

So I would weigh startup and footprint much more than before, but per workload, not as one rule. Spring has narrowed the gap with frameworks built for this: AOT processing at build time, GraalVM native image support, and CDS on the JVM, and the JDK's Project Leyden is adding ahead-of-time caching that keeps the normal programming model.

For a steady long-running service I would stay on the JVM and take cheap wins like CDS or the Leyden cache. For spiky services and functions that start constantly, I would consider native image, accepting the longer builds and reflection limits. I would base each decision on measurements of real services.

And to keep options open for five years, I would ask teams to avoid heavy reflection and dynamic classpath tricks, and to run an AOT or native build of key services in CI, so switching later is cheap.

About this answer

Last updated
12 November 2026
Versions it names
Java 24, Java 25, Spring Framework 6
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
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 "Startup time mattered little when apps were deployed a few times a year, and much more...": https://scrivio-interview-library.netlify.app/spring-boot/boot-startup/55efdb8fa5/