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

Java11-G1GC-需要了解年轻一代gc日志及其对应用程序线程的影响,java,garbage-collection,g1gc,Java,Garbage Collection,G1gc,我正在运行一个启用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) 705

我正在运行一个启用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
,这是非常糟糕的。如果没有调试消息,就无法说明发生这种情况的原因,可能是机器上启动了线程,可能是区域之间的连接太多,因此需要花费大量时间扫描记忆集,或者其他任何原因


但底线是,在这些周期中,您的应用程序表现非常糟糕;您说得对。

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


但底线是,在这些周期中,您的应用程序表现非常糟糕;你说得对。

总的来说,你是对的,在这种情况下,你的应用程序非常困难。您能启用调试并显示GC日志的输出吗?如果没有调试模式下的日志,顺便说一句,这是不可能回答的…我没有那个时间点的日志,但我会看看是否可以将最新和详细的GC日志粘贴到这里。@Eugene到现在为止,我没有显示类似行为的适当日志,你的第一条评论回答了我在这篇文章中提出的问题。请把它贴出来,我会记下答案。总的来说,你是正确的,你的应用程序在这种情况下非常困难。您能启用调试并显示GC日志的输出吗?如果没有调试模式下的日志,顺便说一句,这是不可能回答的…我没有那个时间点的日志,但我会看看是否可以将最新和详细的GC日志粘贴到这里。@Eugene到现在为止,我没有显示类似行为的适当日志,你的第一条评论回答了我在这篇文章中提出的问题。请把它寄出去,我会把它标出来。