particular method. Lowering the compile threshold, particularly for the server compiler, runs
the risk that the code may be compiled a little less optimally than possible—but testing on an
application may show that there is in fact little difference between compiling after, say, 8,000
invocations instead of 10,000.
You can bet that vendors who submit benchmark results with that tuning have verified there
is no performance difference between the two settings for that benchmark. They use the
lower setting for two reasons:
▪ It saves a little time in how long the application needs to warm up.
▪ It can compile certain server methods that would otherwise never compile.
The first point here should be well understood, but why would the server never compile an
important method? It isn't just that the compilation threshold hasn't been reached yet: it's
that the compilation threshold will never be reached. This is because the counter values in-
crease as methods and loops are executed, but they also decrease over time.
Periodically (specifically, when the JVM reaches a safepoint), the value of each counter is re-
duced. Practically speaking, this means that the counters are a relative measure of the recent
hotness of the method or loop. One side effect of this is that somewhat-frequently executed
code may never be compiled, even for programs that run forever (these methods are some-
times called lukewarm [as opposed to hot]). This is one case where reducing the compilation
threshold can be beneficial, and it is another reason why tiered compilation is usually slightly
faster than the server compiler alone. The next section will show how to determine if a par-
ticular method is not compiled; if methods in the critical path of the profiles for your applica-
tion show they are not compiled, compilation can sometimes be achieved by reducing the
1. Compilation occurs when the number of times a method or loop has been ex-
ecuted reaches a certain threshold.
2. Changing the threshold values can cause the code to be compiled sooner than it
3. “Lukewarm” methods will never reach the compilation threshold (particularly for
the server compiler) since the counters decay over time.