从Java5移动到6后,GC行为发生变化 [英] Change in GC behaviour after move from Java5 to 6

查看:100
本文介绍了从Java5移动到6后,GC行为发生变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近将系统从Sun Java 5迁移到Java6服务器虚拟机(特别是Linux 32位上的1.6.0_16)。我们注意到垃圾收集行为已经发生了变化,从而触发了我们的堆警告监控系统。

堆使用情况图显示了比我们在Java5上看到的更棘手的内存使用情况配置文件,虚拟机在运行大型GC之前让堆使用率变得非常高。它似乎不是应用系统本身的问题(它从来没有真正耗尽内存),但是当监视系统的使用峰值接近临界值时,它给监视系统偶尔出现虚假的发热信号。



我们可以增加堆的最大数量,并希望秒杀不会变得更大,但我更愿意了解我们是否有办法调整JVM参数,使得我们获得更流畅的配置文件,即使我们失去了一点性能。



我猜可能有一些-XX选项我们可以做到这一点,但我没有看到文档中的任何这样的事情。任何人都知道这样的选择?

解决方案

听起来像你真的想要更像一个并发收集(与标准的大爆炸收藏相对) p>


并发收集器设计为
,适用于更短的
垃圾收集暂停的应用程序,并且
可以承担使用垃圾收集器共享处理器资源
,同时运行
应用程序。


也许更重要的是,您应该确保你使用了正确的虚拟机和正确的选项,超过了特定的垃圾收集选项。例如,我绊倒了客户端与服务器虚拟机在我自己的生活中多次出现。


We've recently migrated our systems from Sun Java 5 to Java6 server VM (specifically, 1.6.0_16 on Linux 32 bit). We've noticed that the garbage collection behaviour has changed in such a way as to trigger our heap-warning monitoring system.

The heap usage graphs indicate a much "spikier" memory usage profile than we saw with Java5, with the VM letting heap usage get very high before running a big GC. It doesn't appear to be a problem with the application system itself (it never actually runs out of memory), but it's giving the monitoring system the occasional spurious "hair on fire" signals whenever the usage spike approaches the threshold.

We could increase the heap max and hope the spike doesn't simply get bigger, but I'd much rather find out if there's a way we can tune the JVM parameters in such a way that we get a smoother profile, even if we loose a bit of performance.

I'm guessing there might be some -XX option we can set to achieve this, but I an't see any such thing in the docs. Anyone know of such an option?

解决方案

It sounds like you would really like to have something more like a concurrent collection (as opposed to standard big-bang collections):

The concurrent collector is designed for applications that prefer shorter garbage collection pauses and that can afford to share processor resources with the garbage collector while the application is running.

Perhaps even more important, you should ensure that you're using the correct VM with the right options, over and above the specific garbage collection options. For example, I've tripped over the client vs. server VM issue multiple times in my own life.

这篇关于从Java5移动到6后,GC行为发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆