Quick revision
The short answer
Startup time is only one number, and it matters only if our instances start often. Before switching we must measure steady-state throughput and latency under realistic load, memory under load rather than at idle, the build time and CI cost of native compilation, and the debugging and profiling experience. We should also try Spring Boot's own startup options (lazy initialization, AOT, CDS and CRaC), because they may close most of the gap without changing frameworks.
What to remember
In this answer, we saw that a 40 ms against 3 second comparison mixes the framework with the runtime model, so we first ask for a fair four-way comparison. Then we measure what decides cost and user experience for a long-running service: throughput, tail latency and CPU per request under realistic load, memory at peak rather than at idle, and the build, CI and debugging costs of native images. Startup only pays when instances start often, as with scale-to-zero, spike autoscaling and short jobs. And Spring Boot's own options, lazy initialization, AOT, CDS, CRaC and native images, can close much of the gap without a rewrite.
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.
Startup time is only one number, and it matters only if our instances start often. Before switching we must measure steady-state throughput and latency under realistic load, memory under load rather than at idle, the build time and CI cost of native compilation, and the debugging and profiling experience. We should also try Spring Boot's own startup options (lazy initialization, AOT, CDS and CRaC), because they may close most of the gap without changing frameworks.
Why this question is asked
A proof of concept that shows 40 ms against 3 seconds is exciting, and it is easy for a team to treat it as the whole answer. But a framework switch costs months of rewriting, retraining and new operational habits, so the decision should rest on the numbers that actually drive our cost and our users' experience. Interviewers ask this to see whether we can separate a striking benchmark from a business case. In this answer, we will see what the 40 ms really measures, which other numbers to collect and how to collect them fairly, when startup time actually pays, and what Spring Boot can do about startup before we decide anything.
1What the Proof of Concept Actually Measured
Startup time is the time from launching the process to the moment it can serve its first request. Quarkus native means the application was compiled ahead of time by GraalVM native-image into a single machine-code executable. There is no JVM warming up, no class loading from jar files and much less work at boot, because a lot of the framework setup was done at build time. That is why it starts in tens of milliseconds.
Spring Boot on the JVM does that work at runtime. It scans the classpath, reads configuration, creates beans and loads classes, and the JVM interprets bytecode until the JIT compiler (the just-in-time compiler that turns hot methods into optimized machine code while the program runs) catches up. Three seconds is a normal result for a medium service.
Notice that the comparison mixes two different things: a framework (Quarkus versus Spring) and a runtime model (native versus JVM). Quarkus can also run on the JVM, and Spring Boot can also be compiled to a native image. A fair proof of concept compares like with like, so the first thing we ask for is a four-way table: Quarkus JVM, Quarkus native, Spring Boot JVM and Spring Boot native. Often most of the gap belongs to the runtime model, not the framework.
| JVM mode | Native image | |
|---|---|---|
| Spring Boot | about 3 s (measured) | measure it, often well under 1 s |
| Quarkus | measure it, often around 1 s | about 40 ms (measured) |
2Measure Steady-State Throughput and Latency Under Load
Most services start once and then run for days. For them the number that matters is how many requests per second one instance handles and how long the slowest requests take, the p99 latency, once the service is warm. Here the JVM often wins. The JIT compiler watches the running program and optimizes the paths it actually uses, inlining methods and removing checks based on real behaviour. A native image is compiled before it has seen any traffic, so it lacks that profile unless we use profile-guided optimization, which needs an extra build step and, depending on the distribution, a commercial GraalVM build; check your version.
So we run the same realistic load test against each variant for long enough to be past warm-up, for example 30 minutes at the traffic level of a busy hour, with the same CPU and memory limits we use in production. We record requests per second, p50, p99 and p99.9 latency, and CPU per request. If the native build needs 20 percent more CPU to serve the same traffic, the fast startup may cost us money every hour of the day.
The garbage collector matters here too. A native image usually uses a simpler collector than the JVM's G1 or ZGC, which can show up as longer pauses or lower throughput with large heaps. We should look at pause times in the load test, not assume them.
3Measure Memory Under Load, Not at Idle
Native images are famous for small memory use, and at idle they really are small. But the number that decides how many instances fit on a node is resident memory, the RSS, the memory the process actually holds, at peak load. Under load, both variants allocate request objects, buffers and caches, and the difference often shrinks. We record RSS at idle, at normal load and at peak, along with the container limit each variant needs to run without being killed for running out of memory.
If the native build saves 150 MB per instance and we run 300 instances, that is real money, about 45 GB of memory. If it saves 30 MB at peak, it probably is not worth a rewrite.
4Count the Build, CI and Debugging Costs
Native compilation is slow and heavy. A medium service can take several minutes and several gigabytes of memory to build, against well under a minute for a normal jar. Multiply that by every pull request, every branch and every developer, and the CI bill and the waiting time grow. Many teams build native images only on the main branch and run JVM mode for local work and pull requests, but then the tested artifact is not quite the shipped artifact.
The developer experience changes as well. Native images need to know about reflection, resources and dynamic proxies at build time, so a library that uses them without metadata may compile and then fail at runtime. Debugging a native binary is harder than attaching a Java debugger, and tools the team relies on, such as JFR recordings, heap dumps, async-profiler and Java agents for monitoring, work differently or only partly. We should ask the people who run the service in production to try diagnosing a slow request in the native build before we commit.
5When Startup Time Actually Pays
Startup only matters when instances start often. The clear cases are scale-to-zero platforms, where an instance starts on the first request and the user waits for it; serverless functions; autoscaling for sharp spikes, where a 3-second start plus readiness checks means the spike is half over before help arrives; short batch jobs or CLI tools that run for seconds; and very dense multi-tenant platforms where many idle instances must be cheap.
For a long-running service behind a load balancer with a few planned deployments a week, a 3-second start is invisible to users. So the key question to the team is how often our instances start and who waits when they do.
- Do instances start on a user request?scale to zero, serverlessYesStartup matters a lotNoKeep checking
- Do we autoscale for spikes shorter than a minute?YesStartup mattersNoKeep checking
- Is it a short batch job or CLI?YesStartup mattersNoThroughput, latency and memory decide
3 steps in order. Play them, or step through them one at a time.
6What Spring Boot Can Do About Startup First
Before switching frameworks we can try cheaper options. Lazy initialization (spring.main.lazy-initialization=true) creates beans when first used instead of at boot, which helps startup but moves the cost and some errors to the first requests. Spring AOT processing generates bean definitions at build time instead of computing them at runtime, and it is the basis of Spring Boot native images. Class Data Sharing (CDS) stores parsed classes in an archive the JVM maps at startup, and recent Java versions add an AOT cache that goes further; Spring Boot 3.3 and later have support for creating these archives, so check your version for the exact steps.
CRaC, Coordinated Restore at Checkpoint, takes a snapshot of a warmed-up running JVM and restores it in tens of milliseconds, keeping JIT-compiled code. Spring Framework 6.1 and later support it, but it needs a JDK build with CRaC and care with open connections and secrets in the snapshot. Finally, Spring Boot itself can be compiled to a native image with GraalVM, which gives native startup times while keeping the Spring code, libraries and team knowledge.
If these bring the service to under one second and the service is not scale-to-zero, the business case for a rewrite is usually gone. If the service really needs 50 ms cold starts, then the comparison is Quarkus native against Spring Boot native, and the deciding factors become library support, build cost and the team's experience.
7Follow-up questions
Is a native image always faster than the JVM?
No. It starts faster and usually uses less memory at idle, but at steady state a warmed-up JVM with the JIT compiler often has equal or higher throughput, because it optimizes code using the real traffic it has seen. A native image is optimized before it has seen any traffic. Profile-guided optimization narrows the gap but adds a build step. The only way to know for our service is a load test past warm-up.
How would you present the findings to the team?
I would put the measurements side by side for the four variants: startup, p99 latency at production load, CPU per request, peak RSS, build time in CI and a note on debugging and library support. Then I would translate them into money and risk for our real traffic pattern, for example instance-hours saved per month against CI minutes added per month and the cost of migrating 40 services. The team then decides from our numbers rather than from the proof of concept's single number.
8Conclusion
In this answer, we saw that a 40 ms against 3 second comparison mixes the framework with the runtime model, so we first ask for a fair four-way comparison. Then we measure what decides cost and user experience for a long-running service: throughput, tail latency and CPU per request under realistic load, memory at peak rather than at idle, and the build, CI and debugging costs of native images. Startup only pays when instances start often, as with scale-to-zero, spike autoscaling and short jobs. And Spring Boot's own options, lazy initialization, AOT, CDS, CRaC and native images, can close much of the gap without a rewrite.
Open with
I would first point out that the proof of concept compares Quarkus native against Spring Boot on the JVM, so it mixes the framework with the runtime model.
Then, if they want more
I would want all four combinations, including Spring Boot native and Quarkus on the JVM. Then I would ask how often our instances actually start. If it is a long-running service behind a load balancer, three seconds at startup is invisible, and what matters is steady-state behaviour.
So I would run the same realistic load test against each variant past warm-up, with production limits, and compare requests per second, p99 latency, CPU per request and memory at peak, not at idle, because the JIT-compiled JVM often wins on throughput.
I would also count the cost of native builds in CI, the extra memory and minutes per pipeline, and check that our libraries work and that we can still profile and debug in production.
Startup really matters for scale-to-zero, serverless, fast autoscaling and short batch jobs, and if that is our case I would compare Quarkus native with Spring Boot native. Before any rewrite I would also try Spring Boot's own options: lazy initialization, AOT processing, CDS archives and CRaC, which often bring startup under a second.
Then I would put the numbers in terms of monthly cost and migration effort and let the team decide on that.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Boot 3.3, 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 official documentation for the version you use. 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 "A proof of concept shows Quarkus native starting in 40 ms against 3 seconds for Spring...": https://scrivio-interview-library.netlify.app/java/other-java-frameworks/aed7daf444/