Java老版本不断增长-需要帮助解释Java GC输出吗

Java老版本不断增长-需要帮助解释Java GC输出吗,java,garbage-collection,Java,Garbage Collection,我在一个性能关键的服务器端Java应用程序上工作 一旦系统启动,我希望不会创建长寿命的对象,只创建寿命较短(最多10秒)的对象。因此,我希望对JVM进行调优,以便在系统启动后旧一代保持不变 我想我已经成功了,但我不明白为什么(见下文) 以下是我们的设置: -Xmx3000m-Xms3000m-verbose:gc-XX:+PrintGCTimeStamps-XX:+PrintGCDetails-XX:+UseConMarkSweepGC-XX:SurvivorRatio=5-XX:TargetS

我在一个性能关键的服务器端Java应用程序上工作

一旦系统启动,我希望不会创建长寿命的对象,只创建寿命较短(最多10秒)的对象。因此,我希望对JVM进行调优,以便在系统启动后旧一代保持不变

我想我已经成功了,但我不明白为什么(见下文)

以下是我们的设置:

-Xmx3000m-Xms3000m-verbose:gc-XX:+PrintGCTimeStamps-XX:+PrintGCDetails-XX:+UseConMarkSweepGC-XX:SurvivorRatio=5-XX:TargetSurvivorRatio=90-XX:MaxTenuringReshold=31-XX:+PrintTenuringDistribution-XX:NewSize=1250m-XX:MaxNewSize=1250m

我们正在使用Oracle的Java1.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的说法,我的老一代人并没有增加。那么所有这些物体都发生了什么呢?

你的年龄是幸存者空间中物体的年龄。因为你有一个很大的伊甸园空间,大多数进入幸存者空间的物体都会相对陈旧。

谢谢彼得。不过我还是很困惑。查看我的问题中包含的第一个GC,我可以看到65225584字节的对象,年龄=15。当第二次GC发生时,这些人的年龄肯定是16岁,所以应该被提升到老一代?我相信只有在幸存者空间不足时,幸存者才会被推到老一代。您的幸存者空间看起来每个为178MB(1250/(5+1+1))。您应该进行堆转储并将其发送给客户端进行分析:)从日志中,看起来最长使用期限为31