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吗?我不确定。 最佳答案
我不明白您为什么担心0.3秒的次要收藏。
如果您确实确实想减少次要收集时间,那么减小新空间的大小就可以做到。但是,这可能会带来副作用,即增加对象的保有权使用率,并导致主要收藏的发生频率更高。