GC基础算法
YGC 日志
2021-09-13T23:47:13.059+0800: 8306957.465: [GC pause (G1 Evacuation Pause) (young)2021-09-13T23:47:13.068+0800: 8306957.474: [SoftReference, 0
refs, 0.0000453 secs]2021-09-13T23:47:13.068+0800: 8306957.474: [WeakReference, 2 refs, 0.0000063 secs]2021-09-13T23:47:13.068+0800: 8306957.47
4: [FinalReference, 8 refs, 0.0000095 secs]2021-09-13T23:47:13.068+0800: 8306957.474: [PhantomReference, 0 refs, 1 refs, 0.0000286 secs]2021-09
-13T23:47:13.068+0800: 8306957.474: [JNI Weak Reference, 0.0000140 secs], 0.0102679 secs]
[Parallel Time: 8.0 ms, GC Workers: 16]
[GC Worker Start (ms): Min: 8306957465.7, Avg: 8306957465.7, Max: 8306957465.8, Diff: 0.1]
[Ext Root Scanning (ms): Min: 0.5, Avg: 0.6, Max: 2.0, Diff: 1.6, Sum: 10.1]
[Update RS (ms): Min: 4.3, Avg: 5.9, Max: 6.2, Diff: 1.9, Sum: 94.4]
[Processed Buffers: Min: 27, Avg: 31.4, Max: 41, Diff: 14, Sum: 502]
[Scan RS (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 1.9]
[Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
[Object Copy (ms): Min: 1.0, Avg: 1.0, Max: 1.1, Diff: 0.1, Sum: 16.4]
[Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.1, Diff: 0.1, Sum: 0.3]
[Termination Attempts: Min: 1, Avg: 1.2, Max: 2, Diff: 1, Sum: 20]
[GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 1.0]
[GC Worker Total (ms): Min: 7.7, Avg: 7.8, Max: 7.9, Diff: 0.2, Sum: 124.2]
[GC Worker End (ms): Min: 8306957473.4, Avg: 8306957473.5, Max: 8306957473.5, Diff: 0.1]
[Code Root Fixup: 0.0 ms]
[Code Root Purge: 0.0 ms]
[Clear CT: 0.4 ms]
[Other: 1.9 ms]
[Choose CSet: 0.0 ms]
[Ref Proc: 0.4 ms]
[Ref Enq: 0.0 ms]
[Redirty Cards: 0.2 ms]
[Humongous Register: 0.1 ms]
[Humongous Reclaim: 0.0 ms]
[Free CSet: 1.0 ms]
[Eden: 2102.0M(2102.0M)->0.0B(2102.0M) Survivors: 8192.0K->8192.0K Heap: 4054.7M(4520.0M)->1953.1M(4520.0M)]
[Times: user=0.13 sys=0.00, real=0.01 secs]
2021-09-13T23:47:13.070+0800: 8306957.476: Total time for which application threads were stopped: 0.0147420 seconds, Stopping threads took: 0.0
001054 seconds
- 2021-09-13T23:47:13.059+0800: 8306957.465: [GC pause (G1 Evacuation Pause) (young) .... 0.0102679 secs]。 (G1 Evacuation Pause) (young)标志是YGC,耗时是 10.2ms。2021-09-13T23:47:13.059 是时间,+800是东八区,8306957.465 是JVM启动后的相对时间(秒)。
- [Parallel Time: 8.0 ms, GC Workers: 16] 表示 并行收集任务,有16 个GC线程,从新生代垃圾收集开始到最后一个任务结束(wall clock time)总共用时 8ms。STW过程。
- [GC Worker Start (ms) Min: 8306957465.7, Avg: 8306957465.7, Max: 8306957465.8, Diff: 0.1]:min指的是 第一个垃圾收集线程开始工作时JVM启动后经过的时间,max指的是最后一个,diff表示min和max之间的差值。理想情况下,你希望他们几乎是同时开始,即diff趋近于0。
- [Ext Root Scanning (ms): Min: 0.5, Avg: 0.6, Max: 2.0, Diff: 1.6, Sum: 10.1]: 扫描root集合(线程栈、JNI、全局变量、系统表等等),尝试找到是否有root集合中的节点指向当前的收集集合(CSet)。Sum表示所有线程花费的total cpu time&#x