gc mimor gc太慢了

时间:2010-12-19 04:57:45

标签: java garbage-collection

    java version "1.6.0_17"
    Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
    Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)


    -server -Xmx3000m -Xms3000m -Xmn650m -XX:PermSize=256M -XX:MaxPermSize=256m 
-XX:+DisableExplicitGC -XX:+UseParNewGC -XX:ParallelGCThreads=8 
-XX:+PrintTenuringDistribution -XX:+UseConcMarkSweepGC 
-XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseParNewGC 


58876.976: [GC 58876.976: [ParNew
Desired survivor size 34078720 bytes, new threshold 1 (max 4)
- age   1:   35092080 bytes,   35092080 total
: 599040K->55380K(599040K), 0.3054020 secs] 1594716K->1113571K(3005440K), 0.3058680 secs] [Times: user=1.85 sys=0.05, real=0.31 secs]
59109.884: [GC 59109.884: [ParNew
Desired survivor size 34078720 bytes, new threshold 4 (max 4)
- age   1:   30958856 bytes,   30958856 total
: 587860K->39545K(599040K), 0.1958710 secs] 1646051K->1131839K(3005440K), 0.1963230 secs] [Times: user=1.26 sys=0.01, real=0.19 secs]
59399.831: [GC 59399.831: [ParNew
Desired survivor size 34078720 bytes, new threshold 1 (max 4)
- age   1:   36009176 bytes,   36009176 total
- age   2:   29223424 bytes,   65232600 total
: 572025K->66560K(599040K), 0.1467870 secs] 1664319K->1162057K(3005440K), 0.1472820 secs] [Times: user=1.11 sys=0.02, real=0.15 secs]
59721.070: [GC 59721.071: [ParNew
Desired survivor size 34078720 bytes, new threshold 1 (max 4)
- age   1:   42097920 bytes,   42097920 total
: 599040K->55945K(599040K), 0.3522740 secs] 1694537K->1214361K(3005440K), 0.3527210 secs]

现在,我的服务器没有访问压力,为什么较小的gc花费0.x秒?我相信较小的gc应该花费不到0.1秒。

因为newRation的默认值是8,那么我应该将-Xmn650m更改为-Xmn350m,我不确定。

1 个答案:

答案 0 :(得分:1)

我不明白为什么你担心0.3秒的次要收藏品。

如果你确实想减少较小的收集时间,那么减小新空间的大小就可以做到这一点。然而,它可能会产生增加物品使用率的副作用,并导致主要收藏更频繁地发生。