简体   繁体   English

高峰 memory usage does not go beyond a limit

[英]Peak memory usage does not go beyond a limit

I see that with -Xmx2g, the peak memory reaches 1G and does major collections (marksweep collector).我看到使用 -Xmx2g 时,峰值 memory 达到 1G 并且主要是 collections(marksweep 收集器)。 With -Xmx3g, it reaches 1.5G and does a major collections. With -Xmg4g, it reaches 2G and does major collections. But, from here I tried increasing max memory to 6G, 8G, 12G and all the times the peak memory reaches 2G does major collections.使用 -Xmx3g,它达到 1.5G 并执行主要的 collections。使用 -Xmg4g,它达到 2G 并执行主要的 collections。但是,从这里我尝试将最大 memory 增加到 6G,8G,12G 并且峰值 memory 始终达到 2G做专业 collections。

How to make it use beyond 2G?如何让它使用超过2G? I didn't come across any setting for this.我没有遇到任何设置。 Does -Xms matter here? -Xms 在这里重要吗? Fo those -Xmx, I made -Xms half of -Xmx.对于那些 -Xmx,我将 -Xms 设为 -Xmx 的一半。

I am using Jetty, Java 1.6.024.我正在使用 Jetty,Java 1.6.024。

UPDATE: Yes, I am using 64-bit JVM. The JVM options I am using are: -Xmx6g -Xms3g -XX:MaxPermSize=256m The way I am determining the peak memory is by looking at the memory graph in JConsole.更新:是的,我使用的是 64 位 JVM。我使用的 JVM 选项是:-Xmx6g -Xms3g -XX:MaxPermSize=256m 我确定峰值 memory 的方法是查看 JConsole 中的 memory 图It reaches 2G and drops (major collection).达到2G就掉线(major collection)。 Old Gen reaches 1.5G max and then drop happens. Old Gen 达到 1.5G 最大值,然后发生掉线。

Thanks, Prams.谢谢,婴儿车。

You have three memory regions, eden, survivor and tenured space.您有三个 memory 区域,eden、survivor 和 tenured 空间。

What I suspect is happenings is that either the tenured or eden spaces are not growing as you increase the maximum size.我怀疑正在发生的事情是,随着最大大小的增加,终身或伊甸园空间都没有增长。

The reason these two regions matters is that when the tenured space fills a Full GC is triggered (I suspect this size is growing) When the eden space fills and there is not enough space in the survivor space to copy all the objects left, a full GC is also triggered.这两个区域很重要的原因是,当永久空间填满时,会触发 Full GC(我怀疑这个大小正在增长) GC 也被触发。

If this is the cause of your problem, you are creating a very large number of medium lived objects which is likely to be a performance problem, unless you can reduce the number created.如果这是问题的原因,那么您正在创建大量中等寿命的对象,这很可能是性能问题,除非您可以减少创建的数量。 An alternative is to specifiy a larger new size which increases the eden size.另一种方法是指定一个更大的新大小,从而增加伊甸园的大小。

Try -mx12g -XX:NewSize=10g - verbosegc试试-mx12g -XX:NewSize=10g - verbosegc

The last option will give your the sizes of the individual spaces when they are cleaned up.最后一个选项将为您提供清理后各个空间的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM