微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Java 11 - G1GC - 需要了解年轻代 gc 日志及其对应用程序线程的影响

如何解决Java 11 - G1GC - 需要了解年轻代 gc 日志及其对应用程序线程的影响

我正在运行一个启用了 G1GC 的 Java 应用程序,我正在打印如下所示的 gc 日志:

[4074.182s][info][gc] GC(1017) Pause Young (normal) (G1 Evacuation Pause) 6869M->6115M(16384M) 7430.860ms
[4082.328s][info][gc] GC(1018) Pause Young (normal) (G1 Evacuation Pause) 6875M->6121M(16384M) 7058.485ms
[4089.592s][info][gc] GC(1019) Pause Young (normal) (G1 Evacuation Pause) 6881M->6126M(16384M) 6172.693ms
[4105.799s][info][gc] GC(1021) Pause Young (normal) (G1 Evacuation Pause) 6892M->6137M(16384M) 6845.922ms
[4114.418s][info][gc] GC(1022) Pause Young (normal) (G1 Evacuation Pause) 6897M->6142M(16384M) 7563.613ms
[4122.805s][info][gc] GC(1023) Pause Young (normal) (G1 Evacuation Pause) 6902M->6148M(16384M) 7326.923ms
[4131.270s][info][gc] GC(1024) Pause Young (normal) (G1 Evacuation Pause) 6908M->6155M(16384M) 7402.222ms
[4140.574s][info][gc] GC(1025) Pause Young (normal) (G1 Evacuation Pause) 6915M->6161M(16384M) 8226.283ms
[4149.429s][info][gc] GC(1026) Pause Young (normal) (G1 Evacuation Pause) 6921M->6167M(16384M) 7779.282ms
[4157.078s][info][gc] GC(1027) Pause Young (normal) (G1 Evacuation Pause) 6927M->6172M(16384M) 6559.166ms

我对这个日志的理解是:

[4074.182s][info][gc] GC(1017) Pause Young (normal) (G1 Evacuation Pause) 6869M->6115M(16384M) 7430.860ms

As per my understanding this shows that 4074.182 seconds after application started,a young generation 
Stop the world gc was kicked in,and heap size before gc heap size was 6869M 
and after gc it reduced to 6115M and it took 7430.860ms (more than 7 seconds).

我的问题:

1. Is this young gc stopping all the application threads ?
2. If it is stopping all the application threads then looks like application is not 
   running at all during all these gc logs were printed because:
    after [4074.182s] young gc kicked in and it took aroung 7.5 seconds (7430.860ms)
    after ~8 seconds,[4082.328s] yound gc kicked in again and took around 7 SEOnds and so on.
   So it looks like application is not getting any free slot here to run ?  

解决方法

是的,您的应用程序已停止,在此期间所有线程都已暂停。有趣的是,GC 只能在大约 6-7 秒内回收 700MB,这绝对是可怕的。如果没有调试消息,就不可能说出为什么会发生这种情况,可能是机器上启动了线程,可能是区域之间的连接太多,因此需要花费大量时间扫描记住的集合,或者任何其他原因。

但最重要的是,在这些周期中,您的应用程序的性能非常糟糕;你说得对。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?