2011-07-15 34 views
9

我在一個性能至關重要的服務器端Java應用程序上工作。Java老一代不斷增長 - 需要幫助解釋Java GC輸出

一旦系統啓動,我預計不會創建長壽命的物體 - 只有短壽命的物體才能生存(長達10秒)。因此,我希望調整JVM,以便在系統啓動後舊系統保持不變。

我想我已經成功了,但我不明白爲什麼(見下文)。

這是我們的設置:

-Xmx3000m -Xms3000m -verbose:GC -XX:+ PrintGCTimeStamps -XX:+ PrintGCDetails -XX:+ UseConcMarkSweepGC -XX:SurvivorRatio = 5 -XX:TargetSurvivorRatio = 90 -XX :MaxTenuringThreshold = 31 -XX:+ PrintTenuringDistribution -XX:NewSize = 1250m -XX:MaxNewSize = 1250m

我們使用Oracle的Java 1.6。

我真的很困惑「PrintTenuringDistribution」標誌的輸出。我看到的輸出是這樣的:

893.866: [GC 893.866: [ParNew 
Desired survivor size 168512712 bytes, new threshold 16 (max 31) 
- age 1: 13251072 bytes, 13251072 total 
- age 2: 1135456 bytes, 14386528 total 
- age 3:  59104 bytes, 14445632 total 
- age 4:  467384 bytes, 14913016 total 
- age 5:  68688 bytes, 14981704 total 
- age 6:  43336 bytes, 15025040 total 
- age 7:  41344 bytes, 15066384 total 
- age 8:  6872 bytes, 15073256 total 
- age 9:  87568 bytes, 15160824 total 
- age 10:  23840 bytes, 15184664 total 
- age 11:  99712 bytes, 15284376 total 
- age 12:  5224 bytes, 15289600 total 
- age 13:  1000 bytes, 15290600 total 
- age 14:  59056 bytes, 15349656 total 
- age 15: 65225584 bytes, 80575240 total 
: 1015468K->95478K(1097152K), 0.0268070 secs] 1387738K->467748K(2889152K), 0.0269910 secs] [Times: user=0.31 sys=0.00, real=0.03 secs] 
899.179: [GC 899.180: [ParNew 
Desired survivor size 168512712 bytes, new threshold 16 (max 31) 
- age 1: 12438336 bytes, 12438336 total 
- age 2: 1531984 bytes, 13970320 total 
- age 3:  87920 bytes, 14058240 total 
- age 4:  58824 bytes, 14117064 total 
- age 5:  463368 bytes, 14580432 total 
- age 6:  68688 bytes, 14649120 total 
- age 7:  43336 bytes, 14692456 total 
- age 8:  40136 bytes, 14732592 total 
- age 9:  6872 bytes, 14739464 total 
- age 10:  87568 bytes, 14827032 total 
- age 11:  23840 bytes, 14850872 total 
- age 12:  99712 bytes, 14950584 total 
- age 13:  2896 bytes, 14953480 total 
- age 14:  1000 bytes, 14954480 total 
- age 15: 65282456 bytes, 80236936 total 
: 1009782K->98799K(1097152K), 0.0383370 secs] 1382052K->471069K(2889152K), 0.0385490 secs] [Times: user=0.36 sys=0.00, real=0.03 secs] 

既然我有很多與年齡= 15個對象中,閾值是16,我希望在一個GC或者(a)被提升到老的每個對象一代,或(b)垃圾收集。

但根據JConsole,我的老一代並沒有增加。那麼所有這些物體發生了什麼?

+0

你應該做一個堆轉儲並將其發送到客戶端進行分析:) –

+0

從日誌看,它看起來像最大的年齡是31 – rohitmohta

回答

1

你的年齡是倖存者空間中的物體。由於你有一個大的伊甸園空間,大多數製作倖存者空間的物品都會比較陳舊。

+0

感謝彼得。我仍然困惑。看看我的問題中包含的第一個GC,我可以看到65225584字節的年齡= 15的對象。到第二次GC發生時,這些年齡肯定是16歲,所以應該被提升到老一代? –

+0

我相信只有在倖存者空間不足的情況下,倖存者纔會被推向舊有。你的倖存者空間似乎是178 MB(1250 /(5 + 1 + 1)) –