I'm trying to write a warm-up routine for a latency sensitive java application in order to optimize the first few transactions that would otherwise be slowed down by dynamic class loading and JIT (mainly).
The problem I'm facing is that even though my warmup code loads all classes and exercises them by calling them many times (at least 100 times -XX:CompileThreshold), later when the actual user logs on these same functions are still marked as "non entrant" and re-compiled again, which causes a latency hit.
The JVM flags are as follows (I only added -XX:+PrintCompilation -verbose:class tp troubleshoot, the others are legacy ):
-Xms5g -Xmx5g -server -XX:+AggressiveHeap -XX:+UseFastAccessorMethods -XX:+PrintGCDetails -XX:CompileThreshold=100 -XX:-CITime -XX:-PrintGC -XX:-PrintGCTimeStamps -XX:+PrintCompilation -verbose:class
#Warmup happens here
12893 2351 my.test.application.hotSpot (355 bytes)
#Real user logs on here
149755 2351 made not entrant my.test.application.hotSpot (355 bytes)
151913 2837 my.test.application.hotSpot (355 bytes)
152079 2351 made zombie my.test.application.hotSpot (355 bytes)
No class loading happens after the warmup (I can see the class loading before though so the flag is working).
It would appear that the function gets a new ID ( 2351 vs 2837 ) which means that somehow it is deemed as "different" by the JVM.
And how can I determine why the JVM decided to recompile this function ?
And I guess that boils down to how can I determine why the ID changed ? What are the criteria ?
I tried marking as many methods and classes as private as I could but to no avail.
This is JRE 1.6.0_45-b06.
Any tips for how to troubleshoot or get more info appreciated ! : )