1. 程式人生 > >【筆記】Minor GC 的gc.log解析

【筆記】Minor GC 的gc.log解析

2016-08-23T02:23:07.219-0200164.3222:[GC3(Allocation Failure4) 64.322: [ParNew5: 613404K->68068K6(613440K)7, 0.1020465 secs8] 10885349K->10880154K9(12514816K)10, 0.1021309 secs11][Times: user=0.78 sys=0.01, real=0.11 secs]12

  1. 2016-08-23T02:23:07.219-0200 – GC發生的時間;
  2. 64.322 – GC開始,相對JVM啟動的相對時間,單位是秒;
  3. GC – 區別MinorGC和FullGC的標識,這次代表的是MinorGC;
  4. Allocation Failure – MinorGC的原因,在這個case裡邊,由於年輕代不滿足申請的空間,因此觸發了MinorGC;
  5. ParNew – 收集器的名稱,它預示了年輕代使用一個並行的 mark-copy stop-the-world 垃圾收集器;
  6. 613404K->68068K – 收集前後年輕代的使用情況;
  7. (613440K) – 整個年輕代的容量;
  8. 0.1020465 secs – 這個解釋用原滋原味的解釋:Duration for the collection w/o final cleanup.
  9. 10885349K->10880154K – 收集前後整個堆的使用情況;
  10. (12514816K) – 整個堆的容量;
  11. 0.1021309 secs – ParNew收集器標記和複製年輕代活著的物件所花費的時間(包括和老年代通訊的開銷、物件晉升到老年代時間、垃圾收集週期結束一些最後的清理物件等的花銷);
  12. [Times: user=0.78 sys=0.01, real=0.11 secs] – GC事件在不同維度的耗時,具體的用英文解釋起來更加合理:
    • user – Total CPU time that was consumed by Garbage Collector threads during this collection
    • sys – Time spent in OS calls or waiting for system event
    • real – Clock time for which your application was stopped. With Parallel GC this number should be close to (user time + system time) divided by the number of threads used by the Garbage Collector. In this particular case 8 threads were used. Note that due to some activities not being parallelizable, it always exceeds the ratio by a certain amount.