Quick revision
The short answer
I would not standardise JIT flags across services. JIT defaults are tuned by HotSpot engineers across many workloads and change between releases, so fixed flags tend to become obsolete or harmful after upgrades, and some flags are removed entirely and then stop the JVM from starting. I would allow a JIT flag only for a specific service with a measured benefit, documented and reviewed at each JDK upgrade, and spend the fleet-level effort on startup, CPU sizing during warmup, regular upgrades and JIT metrics in standard dashboards.
What to remember
In this answer, we saw why standardising JIT flags is a poor idea: the defaults are tuned by HotSpot engineers on many workloads and change between releases, fixed flags go stale, and expired flags can stop the JVM from starting. A better policy allows flags only with measured benefit, documentation, an owner and re-measurement at each upgrade. The fleet-level effort goes to startup with CDS and the AOT cache, CPU sizing during warmup, regular JDK upgrades and JIT metrics in standard dashboards.
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.
I would not standardise JIT flags across services. JIT defaults are tuned by HotSpot engineers across many workloads and change between releases, so fixed flags tend to become obsolete or harmful after upgrades, and some flags are removed entirely and then stop the JVM from starting. I would allow a JIT flag only for a specific service with a measured benefit, documented and reviewed at each JDK upgrade, and spend the fleet-level effort on startup, CPU sizing during warmup, regular upgrades and JIT metrics in standard dashboards.
Why this question is asked
Platform teams standardise things for good reasons: fewer surprises, easier support, and one place to improve. JIT flags look like another candidate. But the JIT is one of the parts of the JVM where defaults are most carefully maintained and most frequently changed, which makes a fixed fleet-wide setting fragile. Interviewers ask this to see whether we can push back with reasons and offer a better use of the team's energy. In this answer, we will look at how JIT defaults are made, what happens to hard-coded flags over time, the policy I would propose for exceptions, and where fleet-level effort pays off more.
1How JIT Defaults Come About
Settings such as the number of compiler threads, the compile thresholds for each tier, the inlining size limits and the code cache size are chosen by the HotSpot engineers who build the compilers. They tune them against large benchmark suites and real applications, and they adjust them as the compilers change. Ergonomics also scale some of them to the machine, for example the compiler thread count follows the CPU count. So the default is not a guess; it is the result of more measurement than any single company can do, and it is kept consistent with the compiler version it ships with.
2What Happens to Hard-Coded Flags
A flag that helped on JDK 11 freezes a decision that the JDK keeps revisiting. When the compiler improves, the old value may stop helping or start hurting, for example a tier threshold chosen for an older C1 that now compiles faster, or an inlining limit that was raised in a later release. Nobody notices, because the flag lives in a shared base image and nobody remembers why it is there.
Some flags go further. OpenJDK deprecates flags, then makes them obsolete, then expires them. An obsolete flag only prints a warning, but an expired or unknown flag makes the JVM refuse to start. A fleet-wide flag in a base image can therefore turn a routine JDK upgrade into a fleet-wide startup failure.
| Aspect | Fleet-wide JIT flags | Measured per-service exception |
|---|---|---|
| Evidence | usually a blog post or an old test | benchmark on that service |
| After a JDK upgrade | may hurt or fail startup | re-measured, kept or removed |
| Ownership | nobody remembers why | named owner and review date |
| Blast radius of a mistake | every service | one service |
Notice that the failure has nothing to do with whether the flag ever helped. It is simply the lifecycle of JVM options, which is why each flag we set becomes something we must maintain.
3The Policy I Would Propose
The default is no JIT flags. A team may add one only when it has measured a benefit on its own service, with a benchmark or a canary showing for example lower p99 or faster time to steady state. The flag is documented with the measurement, the JDK version, an owner and a review date. At every JDK upgrade, the platform's upgrade checklist lists all JIT flags in use, and each is either re-measured or removed. A CI check can catch flags that the new JDK reports as deprecated or obsolete before anything is deployed.
This keeps the benefit of standardisation, one place that knows every flag in the fleet, without freezing decisions that belong to the JDK.
- Team asks for a JIT flagwith the problem it solves
- Measured benefit on this service?Yesdocument flag, owner, review dateNouse defaults; look at warmup and CPU instead
- Every JDK upgradere-measure each flag
- Still helps on the new JDK?Yeskeep itNoremove it
4 steps in order. Play them, or step through them one at a time.
4Where Fleet-Level Effort Pays Off
If the goal behind the request is faster warmup or lower CPU, there are better fleet-wide levers. Startup work can be cut with Class Data Sharing and the AOT cache, which since JDK 25 can store method profiles from a training run, and the platform can build that into the image pipeline once for everyone. CPU sizing during warmup matters more than compiler thread counts, because the JIT needs real CPU time in the first minutes; allowing bursting or a startup boost helps every service. Regular JDK upgrades bring compiler improvements for free.
We also make the JIT visible. Standard dashboards should include compilation time from JFR, code cache usage and the code cache full warning, and deoptimisation counts. When a team believes the JIT is their problem, those metrics either confirm it with data or point elsewhere.
5Follow-up questions
Are there JIT flags you would accept fleet-wide?
Very few. Diagnostic logging that is cheap and has no effect on code generation, such as making JFR available, is fine. A larger ReservedCodeCacheSize for a class of very large applications can be justified if code cache full warnings appear. Even then, I would tie it to a workload profile rather than to every service, and review it at upgrades.
What if a vendor recommends specific JIT flags?
We treat the recommendation as a hypothesis and measure it on our workload with the JDK version we actually run. Vendor advice often dates from an older JDK. If it helps, it becomes a documented exception like any other.
How do you handle the team's frustration if you say no?
By addressing the problem they wanted to solve. Usually it is slow warmup or high CPU, and we can offer concrete help: AOT cache in the image, startup CPU bursting, readiness gating, or a profile of their hot code. Saying no to the flag and yes to the outcome keeps the relationship good.
6Conclusion
In this answer, we saw why standardising JIT flags is a poor idea: the defaults are tuned by HotSpot engineers on many workloads and change between releases, fixed flags go stale, and expired flags can stop the JVM from starting. A better policy allows flags only with measured benefit, documentation, an owner and re-measurement at each upgrade. The fleet-level effort goes to startup with CDS and the AOT cache, CPU sizing during warmup, regular JDK upgrades and JIT metrics in standard dashboards.
Open with
My position would be: do not standardise JIT flags, standardise the process instead. The JIT defaults, thresholds, compiler threads, inlining limits, are tuned by the HotSpot engineers on far more workloads than we have, they scale with the machine, and they change between releases as the compilers improve.
Then, if they want more
A flag frozen in a base image goes stale: it may stop helping or start hurting after an upgrade, and nobody remembers why it is there. Worse, flags get deprecated, then obsolete, then expire, and an unrecognised flag stops the JVM from starting, so one fleet-wide flag can turn a JDK upgrade into an outage.
So I would allow a JIT flag only for a specific service with a measured benefit, documented with an owner, and re-measured or removed at each JDK upgrade, ideally with a CI check for deprecated options.
Then I would redirect the platform effort to what really helps: CDS and the AOT cache built into images, enough CPU during warmup because the JIT needs real CPU time, regular JDK upgrades, and JIT metrics such as compile time, code cache usage and deoptimisations in the standard dashboards.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Java 11, Java 25
- 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.
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 platform team wants to standardise JIT-related flags such as compiler thread counts...": https://scrivio-interview-library.netlify.app/java/jit-compilation/4b2d3909a2/