Reputation:
Our application is latency critical. In order to reduce GC pauses, we reuse objects. In beginning of the process we allocate a lot of small objects and then (almost) no memory allocated. However, I still see following log of gc:
2016-12-18T13:51:48.650+0200: 1.085: Total time for which application threads were stopped: 0.0001411 seconds, Stopping threads took: 0.0000203 seconds
2016-12-18T13:51:48.776+0200: 1.210: Total time for which application threads were stopped: 0.0002027 seconds, Stopping threads took: 0.0000183 seconds
2016-12-18T13:51:48.894+0200: 1.328: Total time for which application threads were stopped: 0.0002559 seconds, Stopping threads took: 0.0000194 seconds
2016-12-18T13:51:48.906+0200: 1.341: Total time for which application threads were stopped: 0.0002159 seconds, Stopping threads took: 0.0000199 seconds
2016-12-18T13:51:49.047+0200: 1.482: Total time for which application threads were stopped: 0.0002842 seconds, Stopping threads took: 0.0000208 seconds
As far, as I understood, JVM stops process to run over all references and mark objects. Is it correct?
Also I see that frequency of such logs decrease with a time. So i think GC tunes some internal parameters and I wish to provide them on the start. Now I run process with following arguments:
-Xms10240m
-Xmx10240m
-server
-XX:+UseG1GC
-noclassgc
All rest arguments related to verbosing GC. Our machine have enough memory to completely avoid gc. How can I explain it to java?
OS: Linux, JVM either oracle or openJDK.
Thank you.
Upvotes: 2
Views: 1855
Reputation: 98334
These are not necessarily garbage collections.
There is a number of other cases (not related to GC) when JVM prints Total time for which application threads were stopped
. See the related answer for details.
Non-GC safepoints are especially frequent at application start-up time due to class loading and recompilation.
If you want to track GC pauses, use -XX:+PrintGCDetails
.
Update
A few tricks to decrease number of non-GC safepoints:
-XX:-UseBiasedLocking
completely disables bias revocation pauses;-XX:+UnlockDiagnosticVMOptions -XX:GuaranteedSafepointInterval=0
disables an obligatory safepoint every second;-XX:-TieredCompilation
disables multi-tier compilation thus reducing number of recompilation-related safepoints.Note: this is just a hint, not a suggestion for production use. The above options may have performance side effects.
Upvotes: 3