简体   繁体   English

JMC飞行记录会强制使用Full GC吗?

[英]Does JMC Flight Recording force Full GC?

I am experiencing some performance related issues (works ok most of the time, and from time to time there's a spike in the response time from 100ms to 4/5s with no apparent reason) in services implemented in OSB. 我在OSB中实现的服务中遇到了一些与性能相关的问题(大多数时候都可以正常工作,并且有时响应时间会从100ms突然增加到4 / 5s,而没有明显的原因)。 One of the hypothesis to explain this situation is the fact that the JVM could be performing a Full GC during those spikes and we are monitoring the JVM using mission control. 其中一个假说来解释这种情况的是,JVM可能这些尖峰期间进行一个完整的GC和我们使用任务控制监视JVM的事实。

The admins tell me that the jvm is running with full gc's disabled, using G1GC and I can see that in the startup command: 该管理员告诉我,JVM具有完全GC的禁用,则使用G1GC运行,我可以看到,在启动的命令:

-XX:+DisableExplicitGC  
-XX:+UseG1GC 
-XX:MaxGCPauseMillis=500 -verbosegc 
-XX:+PrintGCDetails 
-XX:+PrintGCDateStamps 

Also, when I analyse the gc logs, there's no logging of Full GC's performed, I could only find (which makes sense based on those configurations): 此外,当我分析GC日志,没有记录的全GC的执行,我只能找到(这使得基于这些配置意义上):

2017-05-02T04:46:10.916-0700: 39228.353: [GC pause (G1 Evacuation Pause) (young), 0.0173177 secs]

However, as soon as I turned on flight recorder in jmc and started some load testing, I immediately noticed Full GCs being performed 但是,只要我在江铃开启飞行记录,并开始了一些负载测试,我立刻注意到正在进行全面的GC

完整的GC示例

and I can see it in the logs: 我可以在日志中看到它:

2017-05-02T05:41:31.297: 548.719: [Full GC (Heap Inspection Initiated GC) 1780->705M(2048M), 3.040 secs]

As soon as I disable flight recorder, I can run the exact same load test over and over again and no Full GC's are recorded in the logs. 当我禁用飞行记录器,我可以一遍一遍地运行完全相同的负载测试,并没有完全GC的被记录在日志中。

Am I missing something here, or is Flight Recorder really forcing the JVM to do Full GC's? 我在这里丢失了什么吗,还是Flight Recorder真的在强迫JVM执行Full GC?

Regards 问候

The documentation says as much : 该文件

The flight recording generated with Heap Statistics enabled will start and end with an old GC. 启用“堆统计”后生成的飞行记录将以旧的GC开始和结束。 Select that old GC in the list of GCs, and then choose the General tab to see the GC Reason as - Heap Inspection Initiated GC . 在GC列表中选择那个旧的GC,然后选择“常规”选项卡以查看“ GC原因- Heap Inspection Initiated GC These GCs usually take slightly longer than other GCs. 这些GC通常比其他GC花费更长的时间。

If you enable Heap Statistics in the recording wizard, the JVM will stop the application and sweep the heap to collect information about it. 如果在记录向导中启用了“堆统计信息”,则JVM将停止应用程序并清除堆以收集有关它的信息。 If you want to be sure of low overhead (1%), use the default recording template (without modifications). 如果要确保低开销(1%),请使用默认的录制模板(不做任何修改)。

Yes, JFR recording does run Full GC at regular interval. 是的,JFR记录确实会定期运行Full GC。 INitially we also wondered about the same but below documentation gives proper details. 最初我们也想知道相同的内容,但是下面的文档提供了适当的详细信息。

https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr005.html https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr005.html

The flight recording generated with Heap Statistics enabled will start and end with an old GC. Select that old GC in the list of GCs, and then choose the General tab to see the GC Reason as - Heap Inspection Initiated GC. These GCs usually take slightly longer than other GCs.

Basically the idea is to look at the objects which are not getting collected even after GC which points towards memory leak. 基本上,该想法是查看即使在GC指向内存泄漏后仍未收集的对象。

If you want to just take a look at entire heap to get idea of all objects in heap, then JFR is not the right way. 如果您只想查看整个堆以了解堆中的所有对象,那么JFR并不是正确的方法。 Just take a heap dump & view it using visual vm by java or any other tools available freely. 只需进行堆转储并使用Java可视化vm或免费提供的任何其他工具进行查看。 While taking heap dump also verify the documentation of command to make sure that heap dump command doesn't run GC. 在进行堆转储时,还请验证命令的文档,以确保堆转储命令未运行GC。 There are options available for that, need to search. 有可用的选项,需要搜索。

Update: Also regarding the GC hypothesis in your question, the best way is to print GC logs through JVM args. 更新:同样关于您问题中的GC假设,最好的方法是通过JVM参数打印GC日志。 There are tools available which takes GC log as input & shows nice graphs with readable stats. 有可用的工具将GC日志作为输入并显示具有可读统计信息的漂亮图形。 So just keep GC logs enabled & do the testing. 因此,只需保持GC日志启用并进行测试即可。 Then when you see issue/slowness etc. take a look at GC log using tools & see how long GC happpened & how much memory got cleared etc. 然后,当您看到问题/缓慢等情况时,请使用工具查看GC日志,并查看GC发生了多长时间以及清除了多少内存等。

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

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