JIT compilation
16 questions in 6 subtopics.
Tiered compilation C1 and C2
Explain tiered compilation in HotSpot: what the interpreter, C1 and C2 each do, and what the compilation levels 0 to 4 mean.A Java service in a container with a CPU limit of 1 takes several minutes to reach steady-state throughput, while the same service with 4 CPUs warms up in under a minute. Explain how CPU count affects JIT compilation, and what you can do.A platform team wants to standardise JIT-related flags such as compiler thread counts and tiered thresholds across all services. What is your position?Inlining
A hot loop callsshape.area() on a List<Shape>. With only Circle and Square in the list it is fast. After adding Triangle objects to the same list, the loop becomes noticeably slower. Explain why.Why is inlining considered the most important JIT optimisation, and what limits it in HotSpot? How can you see inlining decisions?After upgrading 200 services from JDK 17 to JDK 21, five services show about 10 percent higher CPU at the same load. Lead the investigation and decide how the fleet upgrade continues.Deoptimization
In -XX:+PrintCompilation output, what does made not entrant mean, and why would a method be compiled more than once?Right after a feature flag enables a new code path in a hot service, latency spikes for several seconds. -XX:+PrintCompilation shows many hot methods made not entrant, then recompiled. Explain what happened and when it becomes a real problem.HotSpot's JIT relies on speculation and deoptimisation, so performance depends on run-time behaviour such as traffic mix and warmup. What does this mean for how a company with latency-critical Java systems approaches performance guarantees over years?Warmup
Why are the first requests after a Java service starts slower than later ones, and how do you warm up safely before taking production traffic?During peak hours your autoscaler adds pods, and each new pod causes elevated p99 latency for about two minutes. Design a fleet-wide approach to the cold-start problem.For 25 years HotSpot started every process from scratch and relied on the JIT to reach peak performance. Explain the trade-off between JIT and ahead-of-time approaches, and why OpenJDK's Project Leyden chose to shift and store work in an AOT cache instead of dropping the JIT.On-stack replacement
What is on-stack replacement in the JVM, and why is it needed?A benchmark consists of a single main method with a loop of one billion iterations timed withSystem.nanoTime. Explain on-stack replacement, and why this benchmark is misleading.Graal JIT
What is the Graal compiler, how does it plug into HotSpot, and what is its status in OpenJDK compared with GraalVM distributions?Your organisation is considering running its JVM fleet on Graal JIT instead of C2 for throughput gains seen in some benchmarks. How do you frame this as a multi-year decision?No question matches these choices.