当我们设置Xmx和Xms的大小相等时会发生什么 [英] What happens when we set Xmx and Xms equal size

查看:1930
本文介绍了当我们设置Xmx和Xms的大小相等时会发生什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们将Xms和Xmx的值设置为相等时,对FullGC的影响是什么,或者是为HotSpot中的年轻人/终身总管分配了什么。

When we set the values of Xms and Xmx to be equal, what is the impact on the FullGC, or allocation for young/ tenured gen in HotSpot.

它在JRockit中有什么不同?

Does it make any difference in JRockit?

推荐答案

将这两个参数设置为相同的值是最佳做法。它会阻止JVM调整堆的大小。主要效果是堆的所有其他部分,特别是几代人,不会因堆大小调整而改变。这可以更好地理解和配置堆。它还消除了调整堆大小造成的暂停。
唯一不会做的secnario是一个客户端Java应用程序,它与许多其他应用程序通过可用内存竞争。在今天的用例中,你经常可以为Java分配一个固定的内存块(例如在所有服务器应用程序中)。

Setting these two parameters to the same value is a best practice. It will prevent the JVM from resizing the heap. The main effect is that all the other parts of the heap, especially the generations, do not change due to heap resizing. This allows to much better understand and configure the heap. It also removes pauses caused by resizing the heap. The only secnario where one would not do it is a client java application, which competes with many other applications over available memory. In todays use cases, you often can assign a fixed chunk of memory to java (in all server apps for example)

这篇关于当我们设置Xmx和Xms的大小相等时会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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