ZGC Major Collection (Proactive) 日志详解

RMAG news

JVM相关参数 -Xms10G -Xmx10G -Xmn5G -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=256M -XX:+UseZGC -XX:+ZGenerational

日志信息

[2024-06-12T19:42:28.946+0800][info][gc ] GC(13451) Major Collection (Proactive)
[2024-06-12T19:42:28.946+0800][info][gc,task ] GC(13451) Using 1 Workers for Young Generation
[2024-06-12T19:42:28.946+0800][info][gc,task ] GC(13451) Using 1 Workers for Old Generation
[2024-06-12T19:42:28.946+0800][info][gc,phases ] GC(13451) Y: Young Generation
[2024-06-12T19:42:28.946+0800][info][gc,phases ] GC(13451) Y: Pause Mark Start (Major) 0.043ms
[2024-06-12T19:42:29.060+0800][info][gc,phases ] GC(13451) Y: Concurrent Mark 113.772ms
[2024-06-12T19:42:29.060+0800][info][gc,phases ] GC(13451) Y: Pause Mark End 0.018ms
[2024-06-12T19:42:29.060+0800][info][gc,phases ] GC(13451) Y: Concurrent Mark Free 0.001ms
[2024-06-12T19:42:29.060+0800][info][gc,phases ] GC(13451) Y: Concurrent Reset Relocation Set 0.013ms
[2024-06-12T19:42:29.062+0800][info][gc,reloc ] GC(13451) Y: Using tenuring threshold: 4 (Computed)
[2024-06-12T19:42:29.064+0800][info][gc,phases ] GC(13451) Y: Concurrent Select Relocation Set 4.493ms
[2024-06-12T19:42:29.064+0800][info][gc,phases ] GC(13451) Y: Pause Relocate Start 0.020ms
[2024-06-12T19:42:29.115+0800][info][gc,phases ] GC(13451) Y: Concurrent Relocate 50.472ms
[2024-06-12T19:42:29.115+0800][info][gc,alloc ] GC(13451) Y: Mark Start Mark End Relocate Start Relocate End
[2024-06-12T19:42:29.115+0800][info][gc,alloc ] GC(13451) Y: Allocation Stalls: 0 0 0 0
[2024-06-12T19:42:29.115+0800][info][gc,load ] GC(13451) Y: Load: 0.81 (2%) / 0.95 (2%) / 1.18 (2%)
[2024-06-12T19:42:29.115+0800][info][gc,mmu ] GC(13451) Y: MMU: 2ms/96.4%, 5ms/98.4%, 10ms/99.2%, 20ms/99.6%, 50ms/99.8%, 100ms/99.9%
[2024-06-12T19:42:29.115+0800][info][gc,marking ] GC(13451) Y: Mark: 1 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s)
[2024-06-12T19:42:29.115+0800][info][gc,marking ] GC(13451) Y: Mark Stack Usage: 32M
[2024-06-12T19:42:29.115+0800][info][gc,nmethod ] GC(13451) Y: NMethods: 10884 registered, 686 unregistered
[2024-06-12T19:42:29.115+0800][info][gc,metaspace] GC(13451) Y: Metaspace: 144M used, 145M committed, 400M reserved
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Candidates Selected In-Place Size Empty Relocated
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Small Pages: 1824 1611 0 3648M 396M 23M
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Medium Pages: 1 0 0 32M 0M 0M
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Large Pages: 0 0 0 0M 0M 0M
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Forwarding Usage: 15M
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Age Table:
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Live Garbage Small Medium Large
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Eden 18M (0%) 3595M (35%) 1791 / 1581 1 / 0 0 / 0
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Survivor 1 4M (0%) 49M (0%) 27 / 25 0 / 0 0 / 0
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Survivor 2 0M (0%) 1M (0%) 1 / 1 0 / 0 0 / 0
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Survivor 3 1M (0%) 4M (0%) 3 / 2 0 / 0 0 / 0
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Survivor 4 0M (0%) 1M (0%) 1 / 1 0 / 0 0 / 0
[2024-06-12T19:42:29.115+0800][info][gc,reloc ] GC(13451) Y: Survivor 5 0M (0%) 1M (0%) 1 / 1 0 / 0 0 / 0
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Min Capacity: 8192M(80%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Max Capacity: 10240M(100%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Soft Max Capacity: 8192M(80%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Heap Statistics:
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Mark Start Mark End Relocate Start Relocate End High Low
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Capacity: 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Free: 6110M (60%) 6072M (59%) 6466M (63%) 9642M (94%) 9642M (94%) 6072M (59%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Used: 4130M (40%) 4168M (41%) 3774M (37%) 598M (6%) 4168M (41%) 598M (6%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Young Generation Statistics:
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Mark Start Mark End Relocate Start Relocate End
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Used: 3680M (36%) 3718M (36%) 3324M (32%) 146M (1%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Live: – 26M (0%) 26M (0%) 25M (0%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Garbage: – 3653M (36%) 3257M (32%) 32M (0%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Allocated: – 38M (0%) 40M (0%) 88M (1%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Reclaimed: – – 396M (4%) 3621M (35%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Promoted: – – 0M (0%) 0M (0%)
[2024-06-12T19:42:29.115+0800][info][gc,heap ] GC(13451) Y: Compacted: – – – 23M (0%)
[2024-06-12T19:42:29.115+0800][info][gc,phases ] GC(13451) Y: Young Generation 4130M(40%)->598M(6%) 0.169s
[2024-06-12T19:42:29.115+0800][info][gc,phases ] GC(13451) O: Old Generation
[2024-06-12T19:42:29.632+0800][info][gc,phases ] GC(13451) O: Concurrent Mark 516.540ms
[2024-06-12T19:42:29.632+0800][info][gc,phases ] GC(13451) O: Pause Mark End 0.021ms
[2024-06-12T19:42:29.632+0800][info][gc,phases ] GC(13451) O: Concurrent Mark Free 0.001ms
[2024-06-12T19:42:29.657+0800][info][gc,phases ] GC(13451) O: Concurrent Process Non-Strong 24.929ms
[2024-06-12T19:42:29.657+0800][info][gc,phases ] GC(13451) O: Concurrent Reset Relocation Set 0.002ms
[2024-06-12T19:42:29.659+0800][info][gc,phases ] GC(13451) O: Concurrent Select Relocation Set 2.376ms
[2024-06-12T19:42:29.659+0800][info][gc,task ] GC(13451) O: Using 1 Workers for Old Generation
[2024-06-12T19:42:29.689+0800][info][gc,task ] GC(13451) O: Using 1 Workers for Old Generation
[2024-06-12T19:42:29.689+0800][info][gc,phases ] GC(13451) O: Concurrent Remap Roots 29.523ms
[2024-06-12T19:42:29.689+0800][info][gc,phases ] GC(13451) O: Pause Relocate Start 0.018ms
[2024-06-12T19:42:29.692+0800][info][gc,phases ] GC(13451) O: Concurrent Relocate 3.222ms
[2024-06-12T19:42:29.692+0800][info][gc,alloc ] GC(13451) O: Mark Start Mark End Relocate Start Relocate End
[2024-06-12T19:42:29.692+0800][info][gc,alloc ] GC(13451) O: Allocation Stalls: 0 0 0 0
[2024-06-12T19:42:29.692+0800][info][gc,load ] GC(13451) O: Load: 0.81 (2%) / 0.95 (2%) / 1.18 (2%)
[2024-06-12T19:42:29.692+0800][info][gc,mmu ] GC(13451) O: MMU: 2ms/96.4%, 5ms/98.4%, 10ms/99.2%, 20ms/99.6%, 50ms/99.8%, 100ms/99.9%
[2024-06-12T19:42:29.692+0800][info][gc,marking ] GC(13451) O: Mark: 1 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s)
[2024-06-12T19:42:29.692+0800][info][gc,marking ] GC(13451) O: Mark Stack Usage: 32M
[2024-06-12T19:42:29.692+0800][info][gc,nmethod ] GC(13451) O: NMethods: 10884 registered, 686 unregistered
[2024-06-12T19:42:29.692+0800][info][gc,metaspace] GC(13451) O: Metaspace: 144M used, 145M committed, 400M reserved
[2024-06-12T19:42:29.692+0800][info][gc,ref ] GC(13451) O: Encountered Discovered Enqueued
[2024-06-12T19:42:29.692+0800][info][gc,ref ] GC(13451) O: Soft References: 3116 447 0
[2024-06-12T19:42:29.692+0800][info][gc,ref ] GC(13451) O: Weak References: 16558 9265 0
[2024-06-12T19:42:29.692+0800][info][gc,ref ] GC(13451) O: Final References: 87 0 0
[2024-06-12T19:42:29.692+0800][info][gc,ref ] GC(13451) O: Phantom References: 2401 1944 704
[2024-06-12T19:42:29.692+0800][info][gc,reloc ] GC(13451) O: Candidates Selected In-Place Size Empty Relocated
[2024-06-12T19:42:29.692+0800][info][gc,reloc ] GC(13451) O: Small Pages: 177 6 0 354M 0M 1M
[2024-06-12T19:42:29.692+0800][info][gc,reloc ] GC(13451) O: Medium Pages: 3 0 0 96M 0M 0M
[2024-06-12T19:42:29.692+0800][info][gc,reloc ] GC(13451) O: Large Pages: 0 0 0 0M 0M 0M
[2024-06-12T19:42:29.692+0800][info][gc,reloc ] GC(13451) O: Forwarding Usage: 1M
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Min Capacity: 8192M(80%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Max Capacity: 10240M(100%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Soft Max Capacity: 8192M(80%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Heap Statistics:
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Mark Start Mark End Relocate Start Relocate End High Low
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Capacity: 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Free: 6110M (60%) 9320M (91%) 9272M (91%) 9278M (91%) 9642M (94%) 6072M (59%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Used: 4130M (40%) 920M (9%) 968M (9%) 962M (9%) 4168M (41%) 598M (6%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Old Generation Statistics:
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Mark Start Mark End Relocate Start Relocate End
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Used: 450M (4%) 452M (4%) 452M (4%) 444M (4%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Live: – 387M (4%) 387M (4%) 387M (4%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Garbage: – 62M (1%) 62M (1%) 49M (0%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Allocated: – 2M (0%) 2M (0%) 6M (0%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Reclaimed: – – 0M (0%) 12M (0%)
[2024-06-12T19:42:29.692+0800][info][gc,heap ] GC(13451) O: Compacted: – – – 1M (0%)
[2024-06-12T19:42:29.692+0800][info][gc,phases ] GC(13451) O: Old Generation 598M(6%)->962M(9%) 0.577s
[2024-06-12T19:42:29.692+0800][info][gc ] GC(13451) Major Collection (Proactive) 4130M(40%)->962M(9%) 0.746s

主要信息:

GC类型: 主动全堆垃圾收集(Proactive Major Collection)
内存变化:

年轻代: 从 4130M(40%)减少到 598M(6%)
老年代: 从 450M(4%)增加到 962M(9%)

阶段信息:

年轻代(Young Generation):

Pause Mark Start: 0.043毫秒
Concurrent Mark: 113.772毫秒
Pause Mark End: 0.018毫秒
Concurrent Mark Free: 0.001毫秒
Concurrent Reset Relocation Set: 0.013毫秒
Concurrent Select Relocation Set: 4.493毫秒
Pause Relocate Start: 0.020毫秒
Concurrent Relocate: 50.472毫秒
年轻代总暂停时间: 0.043毫秒 + 0.018毫秒 + 0.020毫秒 = 0.081毫秒
年轻代内存变化: 4130M(40%)减少到 598M(6%),用时 0.169秒

老年代(Old Generation):

Concurrent Mark: 516.540毫秒
Pause Mark End: 0.021毫秒
Concurrent Mark Free: 0.001毫秒
Concurrent Process Non-Strong: 24.929毫秒
Concurrent Reset Relocation Set: 0.002毫秒
Concurrent Select Relocation Set: 2.376毫秒
Pause Relocate Start: 0.018毫秒
Concurrent Relocate: 3.222毫秒
老年代总暂停时间: 0.021毫秒 + 0.018毫秒 = 0.039毫秒
老年代内存变化: 450M(4%)增加到 962M(9%),用时 0.577秒

总的暂停时间: 0.081毫秒(年轻代)+ 0.039毫秒(老年代) = 0.120毫秒
垃圾收集总时间: 0.746秒

[info][gc,phases ] GC(13451) Y: Young Generation
[info][gc,phases ] GC(13451) Y: Pause Mark Start (Major) 0.043ms
[info][gc,phases ] GC(13451) Y: Concurrent Mark 113.772ms
[info][gc,phases ] GC(13451) Y: Pause Mark End 0.018ms
[info][gc,phases ] GC(13451) Y: Concurrent Mark Free 0.001ms
[info][gc,phases ] GC(13451) Y: Concurrent Reset Relocation Set 0.013ms
[info][gc,reloc ] GC(13451) Y: Using tenuring threshold: 4 (Computed)
[info][gc,phases ] GC(13451) Y: Concurrent Select Relocation Set 4.493ms
[info][gc,phases ] GC(13451) Y: Pause Relocate Start 0.020ms
[info][gc,phases ] GC(13451) Y: Concurrent Relocate 50.472ms

Young Generation:

Pause Mark Start:

时间:2024-06-12T19:42:28.946+0800
描述:这个阶段是年轻代标记阶段的开始,JVM 暂停应用线程以开始标记存活对象。
暂停时间:0.043 毫秒

Concurrent Mark:

时间:2024-06-12T19:42:29.060+0800
描述:并发标记阶段,JVM 在不暂停应用线程的情况下,标记所有存活对象。
持续时间:113.772 毫秒

Pause Mark End:

时间:2024-06-12T19:42:29.060+0800
描述:这个阶段是并发标记阶段的结束,JVM 再次短暂暂停应用线程以完成标记工作。
暂停时间:0.018 毫秒

Concurrent Mark Free:

时间:2024-06-12T19:42:29.060+0800
描述:并发标记释放阶段,清理在标记过程中已确定为垃圾的对象。
持续时间:0.001 毫秒

Concurrent Reset Relocation Set:

时间:2024-06-12T19:42:29.060+0800
描述:并发重置重定位集阶段,为重定位阶段做准备。
持续时间:0.013 毫秒

Using tenuring threshold: 4 (Computed):

时间:2024-06-12T19:42:29.062+0800
描述:设置晋升阈值,决定对象在晋升到老年代前在年轻代的存活次数。晋升阈值不是一个静态值;它是由JVM根据应用程序的运行时特性动态计算的。JVM持续监控对象分配和存活的行为,调整阈值以优化GC性能。
阈值:4

Concurrent Select Relocation Set:

时间:2024-06-12T19:42:29.064+0800
描述:并发选择重定位集阶段,选择需要被移动的对象集。
持续时间:4.493 毫秒

Pause Relocate Start:

时间:2024-06-12T19:42:29.064+0800
描述:开始重定位阶段,JVM 再次短暂暂停应用线程以开始对象的重定位。
暂停时间:0.020 毫秒

Concurrent Relocate:

时间:2024-06-12T19:42:29.115+0800
描述:并发重定位阶段,在不暂停应用线程的情况下,将存活对象移动到新的位置。
持续时间:50.472 毫秒

[info][gc,alloc ] GC(13451) Y: Mark Start Mark End Relocate Start Relocate End
[info][gc,alloc ] GC(13451) Y: Allocation Stalls: 0 0 0 0

ZGC年轻代垃圾回收过程中的内存分配暂停情况。

Mark Start:标记开始阶段的内存分配暂停次数。
Mark End:标记结束阶段的内存分配暂停次数。
Relocate Start:重定位开始阶段的内存分配暂停次数。
Relocate End:重定位结束阶段的内存分配暂停次数。

Allocation Stalls:这一列表示在各个阶段内存分配的暂停次数。从日志可以看出,在标记开始、标记结束、重定位开始和重定位结束阶段,内存分配暂停次数均为0。这表明在整个年轻代GC过程中,没有发生任何内存分配暂停。

[info][gc,load ] GC(13451) Y: Load: 0.81 (2%) / 0.95 (2%) / 1.18 (2%)

这显示了GC期间系统的负载。三个数值分别表示1分钟、5分钟和15分钟的平均负载,括号内的数值为GC期间的CPU占用率。

[info][gc,mmu ] GC(13451) Y: MMU: 2ms/96.4%, 5ms/98.4%, 10ms/99.2%, 20ms/99.6%, 50ms/99.8%, 100ms/99.9%

Minimum Mutator Utilization:这是一个关键的性能指标,表示在不同时间窗口内,应用线程的可用率。它描述了在这些时间窗口内应用线程可用的最小百分比。

[info][gc,marking ] GC(13451) Y: Mark: 1 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s)

这个记录了GC标记阶段的细节。stripe(s)表示标记阶段被分割成的条纹数量,proactive flush(es)和terminate flush(es)表示主动刷新和终止刷新次数,completion(s)和continuation(s)则记录了完成和继续标记的次数。

[info][gc,marking ] GC(13451) Y: Mark Stack Usage: 32M

这是标记阶段使用的堆栈大小,32M表示在标记过程中使用了32MB的堆栈空间。

[info][gc,nmethod ] GC(13451) Y: NMethods: 10884 registered, 686 unregistered

这是JIT编译的方法数量,表示注册了10884个方法,并且有686个方法被注销。这里的“unregistered”表示这些方法曾经被JIT编译并注册过,但现在已经被注销或从代码缓存中移除。这通常发生在方法不再需要时,或者当代码缓存需要回收空间以用于新的编译方法时。

[info][gc,metaspace] GC(13451) Y: Metaspace: 144M used, 145M committed, 400M reserved

记录了元空间的使用情况。144M used表示已经使用的内存,145M committed表示已经分配的内存,400M reserved表示保留的内存。

[info][gc,reloc ] GC(13451) Y: Candidates Selected In-Place Size Empty Relocated
[info][gc,reloc ] GC(13451) Y: Small Pages: 1824 1611 0 3648M 396M 23M
[info][gc,reloc ] GC(13451) Y: Medium Pages: 1 0 0 32M 0M 0M
[info][gc,reloc ] GC(13451) Y: Large Pages: 0 0 0 0M 0M 0M
[info][gc,reloc ] GC(13451) Y: Forwarding Usage: 15M

这段日志记录了ZGC年轻代垃圾回收过程中内存页面的重定位信息。

Candidates:

表示候选页面的数量。这些页面是GC认为可能需要重定位的页面。
Small Pages: 1824 个候选页面
Medium Pages: 1 个候选页面
Large Pages: 0 个候选页面

Selected:

表示实际选择用于重定位的页面数量。
Small Pages: 1611 个页面被选择用于重定位
Medium Pages: 0 个页面被选择
Large Pages: 0 个页面被选择

In-Place:

表示那些可以在原地进行重定位的页面数量。这些页面无需移动到其他位置。
Small Pages: 0 个页面
Medium Pages: 0 个页面
Large Pages: 0 个页面

Size:

表示这些页面的总大小。
Small Pages: 总大小为 3648MB
Medium Pages: 总大小为 32MB
Large Pages: 总大小为 0MB

Empty:

表示在重定位过程中被标记为空的页面大小。
Small Pages: 396MB 被标记为空
Medium Pages: 0MB 被标记为空
Large Pages: 0MB 被标记为空

Relocated:

表示实际被重定位的页面大小。
Small Pages: 23MB 被重定位
Medium Pages: 0MB 被重定位
Large Pages: 0MB 被重定位

Forwarding Usage:

表示在重定位过程中使用的转发指针的大小。
Forwarding Usage: 15MB

[info][gc,reloc ] GC(13451) Y: Age Table:
[info][gc,reloc ] GC(13451) Y: Live Garbage Small Medium Large
[info][gc,reloc ] GC(13451) Y: Eden 18M (0%) 3595M (35%) 1791 / 1581 1 / 0 0 / 0
[info][gc,reloc ] GC(13451) Y: Survivor 1 4M (0%) 49M (0%) 27 / 25 0 / 0 0 / 0
[info][gc,reloc ] GC(13451) Y: Survivor 2 0M (0%) 1M (0%) 1 / 1 0 / 0 0 / 0
[info][gc,reloc ] GC(13451) Y: Survivor 3 1M (0%) 4M (0%) 3 / 2 0 / 0 0 / 0
[info][gc,reloc ] GC(13451) Y: Survivor 4 0M (0%) 1M (0%) 1 / 1 0 / 0 0 / 0
[info][gc,reloc ] GC(13451) Y: Survivor 5 0M (0%) 1M (0%) 1 / 1 0 / 0 0 / 0

这段日志记录了ZGC在年轻代垃圾回收过程中各个年龄段的内存状态。

Age Table (年龄表):

表示ZGC在内存中的不同年龄段的对象分布。
包含了三个主要字段:Live(存活对象),Garbage(垃圾对象),Small(小页面),Medium(中页面),Large(大页面)。

Eden:

Live: 18M (0%) 表示在伊甸区的存活对象占用18MB,占总内存的0%。
Garbage: 3595M (35%) 表示在伊甸区的垃圾对象占用3595MB,占总内存的35%。
Small: 1791 / 1581 表示有1791个小页面候选页面中有1581个被选择用于重定位。
Medium: 1 / 0 表示有1个中页面候选页面,没有被选择用于重定位。
Large: 0 / 0 表示没有大页面候选页面。

Survivor:

Survivor 1:

Live: 4M (0%) 表示在Survivor 1区的存活对象占用4MB,占总内存的0%。
Garbage: 49M (0%) 表示在Survivor 1区的垃圾对象占用49MB,占总内存的0%。
Small: 27 / 25 表示有27个小页面候选页面中有25个被选择用于重定位。
Medium: 0 / 0 表示没有中页面候选页面。
Large: 0 / 0 表示没有大页面候选页面。

Survivor 2:

Live: 0M (0%) 表示在Survivor 2区的存活对象占用0MB,占总内存的0%。
Garbage: 1M (0%) 表示在Survivor 2区的垃圾对象占用1MB,占总内存的0%。
Small: 1 / 1 表示有1个小页面候选页面,有1个被选择用于重定位。
Medium: 0 / 0 表示没有中页面候选页面。
Large: 0 / 0 表示没有大页面候选页面。

Survivor 3:

Live: 1M (0%) 表示在Survivor 3区的存活对象占用1MB,占总内存的0%。
Garbage: 4M (0%) 表示在Survivor 3区的垃圾对象占用4MB,占总内存的0%。
Small: 3 / 2 表示有3个小页面候选页面中有2个被选择用于重定位。
Medium: 0 / 0 表示没有中页面候选页面。
Large: 0 / 0 表示没有大页面候选页面。

Survivor 4:

Live: 0M (0%) 表示在Survivor 4区的存活对象占用0MB,占总内存的0%。
Garbage: 1M (0%) 表示在Survivor 4区的垃圾对象占用1MB,占总内存的0%。
Small: 1 / 1 表示有1个小页面候选页面,有1个被选择用于重定位。
Medium: 0 / 0 表示没有中页面候选页面。
Large: 0 / 0 表示没有大页面候选页面。

Survivor 5:

Live: 0M (0%) 表示在Survivor 5区的存活对象占用0MB,占总内存的0%。
Garbage: 1M (0%) 表示在Survivor 5区的垃圾对象占用1MB,占总内存的0%。
Small: 1 / 1 表示有1个小页面候选页面,有1个被选择用于重定位。
Medium: 0 / 0 表示没有中页面候选页面。
Large: 0 / 0 表示没有大页面候选页面。

[info][gc,heap ] GC(13451) Y: Min Capacity: 8192M(80%)
[info][gc,heap ] GC(13451) Y: Max Capacity: 10240M(100%)
[info][gc,heap ] GC(13451) Y: Soft Max Capacity: 8192M(80%)

这段日志记录了ZGC中关于堆内存容量的配置情况。

Min Capacity (最小容量):

值:8192M (80%)
解释:表示堆内存的最小容量为8192MB,占最大堆内存容量的80%。这是ZGC在初始化时预留的内存。

Max Capacity (最大容量):

值:10240M (100%)
解释:表示堆内存的最大容量为10240MB,占最大堆内存容量的100%。这是JVM进程可以使用的最大内存容量。

Soft Max Capacity (软最大容量):

值:8192M (80%)
解释:表示堆内存的软最大容量为8192MB,占最大堆内存容量的80%。这是ZGC试图维持的内存使用上限。如果超过这个值,ZGC会努力回收垃圾,以减少内存使用,但不会强制限制内存使用在这个值以下。

[info][gc,heap ] GC(13451) Y: Heap Statistics:
[info][gc,heap ] GC(13451) Y: Mark Start Mark End Relocate Start Relocate End High Low
[info][gc,heap ] GC(13451) Y: Capacity: 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%) 8360M (82%)
[info][gc,heap ] GC(13451) Y: Free: 6110M (60%) 6072M (59%) 6466M (63%) 9642M (94%) 9642M (94%) 6072M (59%)
[info][gc,heap ] GC(13451) Y: Used: 4130M (40%) 4168M (41%) 3774M (37%) 598M (6%) 4168M (41%) 598M (6%)

这段日志记录了GC(垃圾收集)过程中堆内存的统计信息。

Capacity (容量):

值:8360M (82%)
解释:堆内存的容量在整个垃圾回收过程中的各个阶段(标记开始、标记结束、重定位开始、重定位结束)保持一致,为8360MB,占最大堆内存容量的82%。

Free (空闲内存):

值:

标记开始:6110M (60%)
标记结束:6072M (59%)
重定位开始:6466M (63%)
重定位结束:9642M (94%)
高水位:9642M (94%)
低水位:6072M (59%)

解释:这是在不同阶段堆内存中空闲的内存量。可以看出,在重定位结束后,空闲内存达到了9642MB,占最大堆内存容量的94%。

Used (已用内存):

值:

标记开始:4130M (40%)
标记结束:4168M (41%)
重定位开始:3774M (37%)
重定位结束:598M (6%)
高水位:4168M (41%)
低水位:598M (6%)

解释:这是在不同阶段堆内存中已用的内存量。在重定位结束后,已用内存减少到598MB,占最大堆内存容量的6%。

[info][gc,heap ] GC(13451) Y: Young Generation Statistics:
[info][gc,heap ] GC(13451) Y: Mark Start Mark End Relocate Start Relocate End
[info][gc,heap ] GC(13451) Y: Used: 3680M (36%) 3718M (36%) 3324M (32%) 146M (1%)
[info][gc,heap ] GC(13451) Y: Live: – 26M (0%) 26M (0%) 25M (0%)
[info][gc,heap ] GC(13451) Y: Garbage: – 3653M (36%) 3257M (32%) 32M (0%)
[info][gc,heap ] GC(13451) Y: Allocated: – 38M (0%) 40M (0%) 88M (1%)
[info][gc,heap ] GC(13451) Y: Reclaimed: – – 396M (4%) 3621M (35%)
[info][gc,heap ] GC(13451) Y: Promoted: – – 0M (0%) 0M (0%)
[info][gc,heap ] GC(13451) Y: Compacted: – – – 23M (0%)
[info][gc,phases ] GC(13451) Y: Young Generation 4130M(40%)->598M(6%) 0.169s

这段日志详细记录了GC(垃圾收集)过程中年轻代内存的统计信息。

Used (已用内存):

值:

标记开始:3680M (36%)
标记结束:3718M (36%)
重定位开始:3324M (32%)
重定位结束:146M (1%)

解释:年轻代在不同阶段的已用内存量。在重定位结束后,已用内存显著减少到146MB,占最大年轻代内存的1%。

Live (存活内存):

值:

标记结束:26M (0%)
重定位开始:26M (0%)
重定位结束:25M (0%)

解释:在标记阶段结束和重定位阶段,存活内存量基本保持不变,说明大部分对象在GC过程中被标记为垃圾并被回收。

Garbage (垃圾内存):

值:

标记结束:3653M (36%)
重定位开始:3257M (32%)
重定位结束:32M (0%)

解释:在标记阶段结束时有3653MB的垃圾内存,重定位开始时减少到3257MB,重定位结束后减少到32MB,表明大量垃圾内存被成功回收。

Allocated (分配内存):

值:

标记结束:38M (0%)
重定位开始:40M (0%)
重定位结束:88M (1%)

解释:在GC过程中,内存分配的变化情况。从标记结束到重定位结束,分配的内存量增加到88MB,占最大年轻代内存的1%。

Reclaimed (回收内存):

值:

重定位开始:396M (4%)
重定位结束:3621M (35%)

解释:在重定位过程中,回收了大量内存,从396MB增加到3621MB,表明垃圾收集器在重定位阶段的有效性。

Promoted (晋升内存):

值:

标记结束:0M (0%)
重定位开始:0M (0%)
重定位结束:0M (0%)

解释:没有对象从年轻代晋升到老年代。

Compacted (压缩内存):

值:

重定位结束:23M (0%)

解释:在重定位过程中,压缩了23MB的内存。

年轻代内存变化:

值:4130M (40%) -> 598M (6%)
解释:年轻代内存从GC前的4130MB(占40%)减少到GC后的598MB(占6%),垃圾收集过程持续了0.169秒。

[info][gc,phases ] GC(13451) O: Old Generation
[info][gc,phases ] GC(13451) O: Concurrent Mark 516.540ms
[info][gc,phases ] GC(13451) O: Pause Mark End 0.021ms
[info][gc,phases ] GC(13451) O: Concurrent Mark Free 0.001ms
[info][gc,phases ] GC(13451) O: Concurrent Process Non-Strong 24.929ms
[info][gc,phases ] GC(13451) O: Concurrent Reset Relocation Set 0.002ms
[info][gc,phases ] GC(13451) O: Concurrent Select Relocation Set 2.376ms
[info][gc,task ] GC(13451) O: Using 1 Workers for Old Generation
[info][gc,task ] GC(13451) O: Using 1 Workers for Old Generation
[info][gc,phases ] GC(13451) O: Concurrent Remap Roots 29.523ms
[info][gc,phases ] GC(13451) O: Pause Relocate Start 0.018ms
[info][gc,phases ] GC(13451) O: Concurrent Relocate 3.222ms

这段日志详细记录了GC过程中老年代内存的统计信息。

Concurrent Mark (并发标记):并发标记阶段是用来标记老年代中的存活对象,这个过程耗时516.540毫秒。
Pause Mark End (暂停标记结束):暂停标记结束阶段,用来确保所有存活对象都被正确标记,耗时0.021毫秒。
Concurrent Mark Free (并发标记清除):并发标记清除阶段,用来清除在并发标记期间标记为存活但已不再存活的对象,耗时0.001毫秒。
Concurrent Process Non-Strong (并发处理非强引用):并发处理非强引用阶段,用来处理软引用、弱引用、虚引用等,耗时24.929毫秒。
Concurrent Reset Relocation Set (并发重置重定位集合):并发重置重定位集合阶段,用来准备重定位集合,耗时0.002毫秒。
Concurrent Select Relocation Set (并发选择重定位集合):并发选择重定位集合阶段,用来选择哪些对象需要被重定位,耗时2.376毫秒。
Using 1 Workers for Old Generation (使用1个工作线程处理老年代):日志记录了在处理老年代时使用了1个工作线程。
Concurrent Remap Roots (并发重映射根):并发重映射根阶段,用来更新根引用指向新的位置,耗时29.523毫秒。
Pause Relocate Start (暂停重定位开始):暂停重定位开始阶段,用来准备重定位对象,耗时0.018毫秒。
Concurrent Relocate (并发重定位):并发重定位阶段,用来实际移动对象到新位置,耗时3.222毫秒。

[info][gc,ref ] GC(13451) O: Encountered Discovered Enqueued
[info][gc,ref ] GC(13451) O: Soft References: 3116 447 0
[info][gc,ref ] GC(13451) O: Weak References: 16558 9265 0
[info][gc,ref ] GC(13451) O: Final References: 87 0 0
[info][gc,ref ] GC(13451) O: Phantom References: 2401 1944 704

软引用 (Soft References)

遇到 (Encountered): 3116
发现 (Discovered): 447
入队 (Enqueued): 0

软引用是一种较弱的引用类型,当内存不足时,垃圾回收器会回收这些对象。在这次垃圾回收过程中,总共遇到了3116个软引用对象,其中有447个被识别为软引用对象(即“发现”)。然而,没有任何一个软引用对象被加入到引用队列中(即Enqueued为0),这意味着在这次GC过程中,没有需要处理的软引用对象。

弱引用 (Weak References)

遇到 (Encountered): 16558
发现 (Discovered): 9265
入队 (Enqueued): 0

弱引用是比软引用更弱的引用类型,垃圾回收器在每次GC时都会回收这些对象。在这次垃圾回收过程中,遇到了16558个弱引用对象,其中9265个被识别为弱引用对象。然而,同样没有任何一个弱引用对象被加入到引用队列中,这意味着这些弱引用对象在本次GC过程中没有进一步处理需求。

终结引用 (Final References)

遇到 (Encountered): 87
发现 (Discovered): 0
入队 (Enqueued): 0

终结引用用于对象在垃圾回收之前需要执行一些清理工作。在这次垃圾回收过程中,总共遇到了87个终结引用对象,没有发现新的终结引用对象,并且没有任何终结引用对象被加入到引用队列中,这表明这些对象不需要立即处理。

虚引用 (Phantom References)

遇到 (Encountered): 2401
发现 (Discovered): 1944
入队 (Enqueued): 704

虚引用是一种最弱的引用类型,主要用于跟踪对象何时被垃圾回收。在这次垃圾回收过程中,遇到了2401个虚引用对象,发现了1944个虚引用对象,并且有704个虚引用对象被加入到引用队列中,这意味着这些对象在本次GC过程中被处理。