Your team is deciding whether to keep running your service on the JVM or move to an ahead-of-time compiled native image to cut cold-start latency. How would you reason about that trade-off?

technical-conceptual · Senior level · software-engineering

What the interviewer is really asking

Assesses whether the candidate understands the JIT-versus-AOT trade-off in terms of workload shape — adaptive peak throughput from a warmed runtime versus immediate startup from AOT — rather than treating 'native is faster' as a blanket truth.

What to say

What to avoid

Example answers

Strong: For our scale-to-zero functions the JVM warmup tax was the whole problem — first requests after a cold start were seconds slower. I moved those to a GraalVM native image and p99 cold-start dropped from ~4s to under 200ms. But for the always-on ingestion service, I kept the JVM, because it stays warm for days and the JIT's profile-guided recompilation beat the native image on sustained throughput in our load test.

Weak: Native images are compiled ahead of time so they're faster than the JVM, so I'd move everything to GraalVM to get better performance and lower memory.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.