GC 日志 - VM 操作事件 - 如何跟踪它们
GC logs - VM operation events - how to track them
我正在使用 GCViewer 检查一些 GC 日志。 (请查看下方截图)
我收到很多似乎与 "vm operation events(application stopped...)" 有关的高停顿(红色矩形)。这些似乎与常规和完整的 GC 停止不同。
我怎样才能知道哪些操作触发了停止事件? (是否有 JVM 标志?)
它们与垃圾回收有区别吗?就 GCViewer 而言,Full GC Pauses + GC Pauses != Total Pause
将 -XX:+PrintSafepointStatistics –XX:PrintSafepointStatisticsCount=1
添加到您的 VM 选项,这应该将有关 non-GC 安全点的信息添加到日志中。
-XX:LogFile=/path/to/file -XX:+LogVMOutput
用于记录到文件。
添加 -XX:+PrintSafepointStatistics –XX:PrintSafepointStatisticsCount=1
将提供有关触发停止事件的操作的信息。
发件人:this link
When safepoints are used?
Below are few reasons for HotSpot JVM to initiate a safepoint:
- Garbage collection pauses
- Code deoptimization
- Flushing code cache
- Class redefinition (e.g. hot swap or instrumentation)
- Biased lock revocation
- Various debug operation (e.g. deadlock check or stacktrace dump)
对于将日志写入文件,这取决于您使用的 VM 版本。
对于所有 Java 版本: Java 8 Docs.
-Xloggc:filename
Sets the file to which verbose GC events information should be redirected for logging. The information written to this file is similar to the output of -verbose:gc
with the time elapsed since the first GC event preceding each logged event. The -Xloggc
option overrides -verbose:gc
if both are given with the same java
command.
来自 Java 版本 8:
-XX:LogFile=path
Sets the path and file name where log data is written. By default, the file is created in the current working directory, and it is named hotspot.log
.
我正在使用 GCViewer 检查一些 GC 日志。 (请查看下方截图)
我收到很多似乎与 "vm operation events(application stopped...)" 有关的高停顿(红色矩形)。这些似乎与常规和完整的 GC 停止不同。
我怎样才能知道哪些操作触发了停止事件? (是否有 JVM 标志?)
它们与垃圾回收有区别吗?就 GCViewer 而言,Full GC Pauses + GC Pauses != Total Pause
将 -XX:+PrintSafepointStatistics –XX:PrintSafepointStatisticsCount=1
添加到您的 VM 选项,这应该将有关 non-GC 安全点的信息添加到日志中。
-XX:LogFile=/path/to/file -XX:+LogVMOutput
用于记录到文件。
添加 -XX:+PrintSafepointStatistics –XX:PrintSafepointStatisticsCount=1
将提供有关触发停止事件的操作的信息。
发件人:this link
When safepoints are used?
Below are few reasons for HotSpot JVM to initiate a safepoint:
- Garbage collection pauses
- Code deoptimization
- Flushing code cache
- Class redefinition (e.g. hot swap or instrumentation)
- Biased lock revocation
- Various debug operation (e.g. deadlock check or stacktrace dump)
对于将日志写入文件,这取决于您使用的 VM 版本。
对于所有 Java 版本: Java 8 Docs.
-Xloggc:filename
Sets the file to which verbose GC events information should be redirected for logging. The information written to this file is similar to the output of
-verbose:gc
with the time elapsed since the first GC event preceding each logged event. The-Xloggc
option overrides-verbose:gc
if both are given with the samejava
command.
来自 Java 版本 8:
-XX:LogFile=path
Sets the path and file name where log data is written. By default, the file is created in the current working directory, and it is named
hotspot.log
.