2016-12-01 65 views
0

這是由ConcMarkSweepGC打印的GC詳細日誌。看起來這個日誌並沒有告訴在這個GarbageCollection中收集多少空間。ConcMarkSweepGC曾經收集多少空間?

我現在JAVA_OPTS是 -XX:+UseConcMarkSweepGC -Xloggc:/home/admin/logs/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps

我真的不知道有多少空間,在這個垃圾回收收集?我是JAVA_OPTS有問題嗎?

日誌:

2016-11-28T20:19:22.937+0800: 357765.356: [GC (CMS Initial Mark) [1 CMS-initial-mark: 1734329K(2097152K)] 1925288K(4019584K), 0.0715106 secs] [Times: user=0.24 sys=0.00, real=0.08 secs] 
2016-11-28T20:19:23.010+0800: 357765.429: [CMS-concurrent-mark-start] 
2016-11-28T20:19:23.826+0800: 357766.246: [CMS-concurrent-mark: 0.815/0.817 secs] [Times: user=0.95 sys=0.04, real=0.81 secs] 
2016-11-28T20:19:23.827+0800: 357766.246: [CMS-concurrent-preclean-start] 
2016-11-28T20:19:23.840+0800: 357766.260: [CMS-concurrent-preclean: 0.013/0.014 secs] [Times: user=0.02 sys=0.00, real=0.02 secs] 
2016-11-28T20:19:23.840+0800: 357766.260: [CMS-concurrent-abortable-preclean-start] 
CMS: abort preclean due to time 2016-11-28T20:19:29.079+0800: 357771.499: [CMS-concurrent-abortable-preclean: 5.229/5.239 secs] [Times: user=5.63 sys=0.11, real=5.24 secs] 
2016-11-28T20:19:29.081+0800: 357771.500: [GC (CMS Final Remark) [YG occupancy: 374645 K (1922432 K)]2016-11-28T20:19:29.081+0800: 357771.501: [Rescan (parallel) , 0.2260699 secs]2016-11-28T20:19:29.307+0800: 357771.727: [weak refs processing, 0.0007908 secs]2016-11-28T20:19:29.308+0800: 357771.727: [class unloading, 0.0830640 secs]2016-11-28T20:19:29.391+0800: 357771.811: [scrub symbol table, 0.0242131 secs]2016-11-28T20:19:29.415+0800: 357771.835: [scrub string table, 0.0032310 secs][1 CMS-remark: 1734329K(2097152K)] 2108975K(4019584K), 0.3421430 secs] [Times: user=1.00 sys=0.00, real=0.34 secs] 
2016-11-28T20:19:29.424+0800: 357771.843: [CMS-concurrent-sweep-start] 
2016-11-28T20:19:30.204+0800: 357772.623: [CMS-concurrent-sweep: 0.780/0.780 secs] [Times: user=0.86 sys=0.01, real=0.78 secs] 
2016-11-28T20:19:30.204+0800: 357772.623: [CMS-concurrent-reset-start] 
2016-11-28T20:19:30.214+0800: 357772.633: [CMS-concurrent-reset: 0.010/0.010 secs] [Times: user=0.01 sys=0.00, real=0.01 secs] 

回答

0

你的JVM選項都不錯。但是,CMS正在同時工作,並且在週期結束時不打印最終大小的舊一代。

您需要查看年輕GC報告以瞭解CMS掃描完成後舊空間中佔用了多少內存。

12.515: [GC (Allocation Failure) 12.515: [ParNew: 34805K->3103K(38080K), 0.0039903 secs] 134805K->103463K(122752K), 0.0040432 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 

在上面後,年輕的GC舊空間的使用習慣是103463K - 3103K = 100360K

您可以計算回收的內存大小,方法是計算最後一次註釋之前的最後一個年輕GC與舊式空間大小在併發重置之後的第一個年輕GC之間的差異。

或者您可以使用優秀的GCViewer工具來可視化您的日誌。

你可以找到更多關於閱讀GC日誌here的信息。

0

的openjdk 8:-XX:+PrintHeapAtGC

的openjdk 9:-Xlog:gc,heap+gc由於新的統一測井系統