本文介绍了ParNew和CMS初始相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我观察到,如果没有最近的ParNew,并且如果CMS-Initial-Mark阶段启动,则CMS-Initial-Mark阶段花费较长时间来标记旧代中的对象。



好的部分是我发现ParNew的大部分时间(可能是偶然的,或者JVM在内部执行这些操作)发生在CMS-Initial-Mark阶段之前,然后标记相同数量的对象在老一代,CMS需要更少的时间。



想知道这个观察背后的推理。

注意:考虑到,CMS-Initial-Mark阶段是停止世界,应该尽量减少其持续时间。

通常情况下,CMS初始标记搭载在年轻的收藏。 CMS可以等待一段时间的年轻收藏(默认2秒)。如果没有发生,初始标记将使用单线程扫描所有年轻的空间,这可能非常耗时。

阅读 http://blog.ragozin.info/2011/06/understanding-gc-pauses-in



热点选项-XX:CMSWaitDuration =<延迟ms>控制CMS初始标记的长度推迟搭载年轻收藏品。

I have observed that when there is no recent ParNew and then if the CMS-Initial-Mark phase kicks-in, the CMS-Initial-Mark phase takes longer time to mark the objects in old generation.

The good part is most of the times I found ParNew (may be by chance or JVM does this internally) occurs just before CMS-Initial-Mark phase and then to mark the same number of objects in old generation, the CMS takes less time.

Would like to know the reasoning behind this observation.

Note: Considering, CMS-Initial-Mark phase is stop-the-world, the best attempt should be made to reduce its duration.

解决方案

Normally CMS initial mark piggyback on young collection. CMS can wait for young collection for some time (2 seconds default). If it is not happening, initial mark will scan all young space using single thread, this could be very time consuming.

Read http://blog.ragozin.info/2011/06/understanding-gc-pauses-in-jvm-hotspots_02.html for more details.

HotSpot option –XX:CMSWaitDuration=<delay in ms> controls how long CMS initial mark could be delayed to piggyback young collection.

这篇关于ParNew和CMS初始相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 05:49