GC输出澄清

时间:2010-05-11 08:53:13

标签: java garbage-collection

我正在使用以下设置运行java应用程序:
-XX:+ CMSParallelRemarkEnabled
-XX:+ UseConcMarkSweepGC
-XX:+ UseParNewGC
-XX:+ PrintGCApplicationStoppedTime
-XX:+ PrintGCApplicationConcurrentTime
-XX:+ PrintGCDetails
-XX:+ PrintGCTimeStamps
-XX:+ PrintGCDateStamps
-XX:+ PrintHeapAtGC
-XX:+ PrintTenuringDistribution

我不确定如何解释相关的gc日志(如下)。特别是:

  • GC调用后的堆= 31(完整3):这是否意味着有31个小型GC和3个完整的GC?

  • 是什么触发连续几行应用程序线程停止的总时间应用程序时间?是否有可能获得与这些线相关的时间戳?

GC日志:

Total time for which application threads were stopped: 0.0046910 seconds  
Application time: 0.7946670 seconds  
Total time for which application threads were stopped: 0.0002900 seconds  
Application time: 1.0153640 seconds  
Total time for which application threads were stopped: 0.0002780 seconds  
Application time: 1.0161890 seconds  
Total time for which application threads were stopped: 0.0002760 seconds  
Application time: 1.0145990 seconds  
Total time for which application threads were stopped: 0.0002950 seconds  
Application time: 0.9999800 seconds  
Total time for which application threads were stopped: 0.0002770 seconds  
Application time: 1.0151640 seconds
Total time for which application threads were stopped: 0.0002730 seconds
Application time: 0.9996590 seconds  
Total time for which application threads were stopped: 0.0002880 seconds  
Application time: 0.9624290 seconds  

{Heap before GC invocations=30 (full 3):  
 par new generation   total 131008K, used 130944K [0x00000000eac00000, 0x00000000f2c00000, 0x00000000f2c00000)  
  eden space 130944K, 100% used [0x00000000eac00000, 0x00000000f2be0000, 0x00000000f2be0000)  
  from space 64K,   0% used [0x00000000f2bf0000, 0x00000000f2bf0000, 0x00000000f2c00000)  
  to   space 64K,   0% used [0x00000000f2be0000, 0x00000000f2be0000, 0x00000000f2bf0000)  
 concurrent mark-sweep generation total 131072K, used 48348K [0x00000000f2c00000, 0x00000000fac00000, 0x00000000fac00000)  
 concurrent-mark-sweep perm gen total 30000K, used 19518K [0x00000000fac00000, 0x00000000fc94c000, 0x0000000100000000)  

2010-05-11T09:30:13.888+0100: 384.955: [GC 384.955: [ParNew  
Desired survivor size 32768 bytes, new threshold 0 (max 0)  
: 130944K->0K(131008K), 0.0052470 secs] 179292K->48549K(262080K), 0.0053030 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]  

Heap after GC invocations=31 (full 3):  
 par new generation   total 131008K, used 0K [0x00000000eac00000, 0x00000000f2c00000, 0x00000000f2c00000)  
  eden space 130944K,   0% used [0x00000000eac00000, 0x00000000eac00000,   0x00000000f2be0000)
  from space 64K,   0% used [0x00000000f2be0000, 0x00000000f2be0000, 0x00000000f2bf0000)  
  to   space 64K,   0% used [0x00000000f2bf0000, 0x00000000f2bf0000, 0x00000000f2c00000)  
 concurrent mark-sweep generation total 131072K, used 48549K [0x00000000f2c00000, 0x00000000fac00000, 0x00000000fac00000)  
 concurrent-mark-sweep perm gen total 30000K, used 19518K [0x00000000fac00000, 0x00000000fc94c000, 0x0000000100000000)  
}

Total time for which application threads were stopped: 0.0056410 seconds  
Application time: 0.0475220 seconds  
Total time for which application threads were stopped: 0.0001800 seconds  
Application time: 1.0174830 seconds  
Total time for which application threads were stopped: 0.0003820 seconds  
Application time: 1.0126350 seconds  
Total time for which application threads were stopped: 0.0002750 seconds  
Application time: 1.0155910 seconds
Total time for which application threads were stopped: 0.0002680 seconds
Application time: 1.0155580 seconds  
Total time for which application threads were stopped: 0.0002880 seconds  
Application time: 1.0155480 seconds  
Total time for which application threads were stopped: 0.0002970 seconds  
Application time: 0.9896810 seconds  

3 个答案:

答案 0 :(得分:2)

是的,这是次要和主要收藏品的数量。有28个小型GC和3个主要GC。

次要集合会触发您引用的那些行。如果没有时间戳,我认为你不能强迫他们修改JVM。但是我的理解是“应用程序时间”是自上次次要收集(暂停)以来应用程序运行的时间,因此可能会为您提供所需的内容。我相信,自上次输出以来,它至少是一个时间差。

答案 1 :(得分:2)

没有时间戳的那些行不是gc事件,它们记录安全点何时发生以及它们持续多长时间。预先6u21他们有点不可靠。

答案 2 :(得分:2)

您将拥有与每个条目相对应的时间戳。

我的服务器日志中的示例显示

124951.831: [GC 1915727K->1295438K(1994752K), 0.1964641 secs]
Total time for which application threads were stopped: 0.1983187 seconds
125015.262: [GC 1909838K->1302111K(1994752K), 0.2037094 secs]
Total time for which application threads were stopped: 0.2055489 seconds

在这种情况下,124951.831和125015.262 自JVM启动以来经过的秒数。

124951.831对应于JVM正常运行时间的34小时,42分钟,31秒。

125015.262对应于34小时,43分钟,35秒的JVM正常运行时间。

您必须将此向后关联到服务器启动时间,因此您可以获得时间戳。

差异很重要(125015 - 124951)显示小型GC在64秒后开始(在我的情况下)。

您的日志中是否缺少这些时间戳行?