为并发 GC 指定额外的 GC 是否有意义?
今天我们使用并发标记扫描,是这样指定的:
-XX:+UseConcMarkSweepGC
我看到一些文章推荐使用这种形式的附加参数:
-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+UseParNewGC
从我读到的内容来看,使用并发标记扫描时会自动指定 UseParNewGC,如果机器只有 1,则需要 CMSIncrementalMode或 2 个 CPU。
那么,考虑到我们的大多数机器都是四核(使 CPU 数量对系统 4 或 8 可见),使用这些附加参数是否有意义?
谢谢!
Today we use the concurrent mark sweep specifying it like this:
-XX:+UseConcMarkSweepGC
I seen some articles recommending using additional parameters in this form:
-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+UseParNewGC
From what I read, the UseParNewGC is specified automatically when using concurrent mark sweeper, and the CMSIncrementalMode required if the machine has only 1 or 2 CPU's.
So, any sense to use these additional parameters, considering the fact most of our machines are quad-core (making the amount of CPU visible to system 4 or 8)?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当
-XX:+CMSIncrementalMode
确定可能是执行此操作的好时机时,它会尝试触发并发清理。我已经使用过它,但我不相信它有帮助。恕我直言,最有用的可能是新的大小,例如 -XX:NewSize=1g -mx2g 要么让它更大或更小,具体取决于你的短寿命对象的寿命。即您希望 eden 大小很小,但又足够大,以便对象通常在清理时被丢弃。
The
-XX:+CMSIncrementalMode
will try to trigger conccurent cleans when it determines it might be a good time to do this. I have used it and I don't believe it helped.IMHO the most useful one to play with is likely to be the new size e.g. -XX:NewSize=1g -mx2g either make it larger or smaller depending on how long lived your short lived objects are. i.e. you want the eden size to be small, but large enough that objects usually are discarded by the time it is cleaned up.