Ctrl K
Java · Senior · Theory

Tell me how JIT compilation works in HotSpot and what optimizations it performs. How does that affect the way you write and measure performance-critical code?

~4 min by voice

How to approach it

This checks whether the candidate understands the real mechanics of HotSpot: the interpreter, profiling, tiered compilation, speculative optimizations and deoptimization. The second thing it looks at is whether they can draw practical conclusions from that: measure correctly with JMH, warm up a service, and explain performance drops.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsYou have a Java service with a 30 GB heap, and the business is complaining about long pauses. How would you choose and tune the garbage collector? SeniorWhat happens to Java code from the moment you write it to the moment it runs? And what is a JIT compiler? JuniorA colleague wrote a microbenchmark: they call a method in a loop and measure the time with System.nanoTime. The results jump around, and the first runs are noticeably slower. Why does this happen, and how do you measure it properly? Mid-levelYour Java service has to respond with a p99 of no more than ten milliseconds. How would you design it with the JVM's characteristics in mind, and how would you find the source of latency if the target isn't being met? Senior

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min