简体   繁体   English

Java Flight Recorder不报告所有GC事件

[英]Java Flight Recorder not reporting all GC events

We have performance build that spawns up our application with the following flags turned on: 我们已经建立了性能构建,并通过以下标志启用了我们的应用程序:

-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=dumponexit=true,dumponexitpath=/tmp/ImaginaryApplication/logs/flightRecorder.jfr -XX:StartFlightRecording=defaultrecording=true,settings=MyCustomSetting

The custom setting was created through Flight Recorder UI, with all settings turned on. 自定义设置是通过Flight Recorder UI创建的,所有设置均已打开。 I guess the important section that is relevant to my question here is the following: 我猜这里与我的问题有关的重要部分是:

  <selection name="gc-level" default="all" label="Garbage Collector">
    <option label="Off" name="off">off</option>
    <option label="Normal" name="detailed">normal</option>
    <option label="All" name="all">all</option>
  </selection>

  <condition name="gc-enabled-normal" true="true" false="false">
    <or>
      <test name="gc-level" operator="equal" value="normal"/>
      <test name="gc-level" operator="equal" value="all"/>
    </or>
  </condition>

  <condition name="gc-enabled-all" true="true" false="false">
    <test name="gc-level" operator="equal" value="all"/>
  </condition>

The flight recording was generated when the build stops. 飞行记录在构建停止时生成。 However, I am not 100% confident that it records everything. 但是,我不是100%确信它会记录所有内容。 For a start, only few GC was reported within the Memory -> Garbage Collection page. 首先,在“内存”->“垃圾收集”页面中仅报告了很少的GC。 I know this, because we also turned on the flag to write the GC into file. 我知道这一点,因为我们还打开了将GC写入文件的标志。 There is way more GC than what was reported in the flight recorder. GC比飞行记录仪中报告的更多。 More importantly, I am worried that the memory allocation result did not record accurate information (just like the GC events). 更重要的是,我担心内存分配结果没有记录准确的信息(就像GC事件一样)。 In which case, we might have spent a lot of effort in tuning the wrong areas.. 在这种情况下,我们可能会花费很多精力来调整错误的区域。

Have I missed any setting here? 我错过了这里的任何设置吗?

Thank you in advance! 先感谢您!

I use settings=profile as the default settings doesn't record all allocation information. 我使用settings=profile因为默认设置不会记录所有分配信息。

Even then it only records the object which triggers a new TLAB which can be large by default. 即使这样,它也仅记录触发新的TLAB的对象,该对象在默认情况下可能很大。 To increase the number samples I shrink the TLAB with -XX:TLABSize=128k NOTE this can hurt performance a little so I wouldnt use except for profiling. 为了增加样本数量,我使用-XX:TLABSize=128k缩小了-XX:TLABSize=128k注意,这可能会影响性能,因此除了进行概要分析外,我不会使用。

By default all garbage collection events are not enabled. 默认情况下,所有垃圾收集事件均未启用。 By that I mean, the main GC events are there, so you can see pause times etc., but not all the gritty details. 我的意思是说,主要的GC事件在那里,所以您可以看到暂停时间等,但不能看到所有棘手的细节。

The easiest way to enable all GC events is to use Java Mission Control and the Recording Wizard to export a configuration. 启用所有GC事件的最简单方法是使用Java Mission Control和“记录向导”导出配置。 Select "All" in the drop down for "Garbage Collection". 在“垃圾收集”下拉菜单中选择“全部”。

If you can't connect to the JVM using JMC, you can use the Flight Recorder Template Manager in JMC, located in the Window menu. 如果无法使用JMC连接到JVM,则可以使用“窗口”菜单中位于JMC中的Flight Recorder模板管理器。 You can import the default.jfc located in JDK_HOME/bin/lib/jfr directory, duplicate it and edit it. 您可以导入JDK_HOME / bin / lib / jfr目录中的default.jfc,对其进行复制和编辑。 Select "All" for Garbage Collection and export the configuration to a new file. 选择“全部”作为垃圾回收并将配置导出到新文件。

You can then start the JVM with: 然后,您可以使用以下命令启动JVM:

java -XX:StartFlightRecording:settings=all-gc-events.jfc

The settings shown in your question are not read by the JVM. JVM不会读取您的问题中显示的设置。 They are only used by JMC to apply settings. 它们仅由JMC用于应用设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM