我应该设置MaxMetaspaceSize吗? [英] Should I set a MaxMetaspaceSize?

查看:3340
本文介绍了我应该设置MaxMetaspaceSize吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在询问了这个问题之后,很快就发现重要的问题不是我怎么能,但我应该吗?

So, after asking this question, it quickly became clear that the important question was not "how can I", but "should I"?

我们有客户说我们正在从Java7迁移到Java8(使用Tomcat7)。 Java7需要设置 -XX:MaxPermSize ,并且由于个人需求和用途,一些客户已将其最大值增加到安装程序的默认设置

We have customers that we are moving from Java7 to Java8 (using Tomcat7). Java7 required setting the -XX:MaxPermSize, and some customers have increased their max above the default set by the installer due to individual needs and uses.

我应该设置 -XX:MaxMetaspaceSize (到之前的<$ c) $ c> -XX:MaxPermSize 设置)已定义自定义最大值的客户?新安装怎么样?我们应该设置 -XX:MaxMetaspaceSize 吗?

Should I set the -XX:MaxMetaspaceSize (to the previous -XX:MaxPermSize setting) for customers who have defined a custom max? What about new installs? Should we set -XX:MaxMetaspaceSize at all?

这样的优点和缺点是什么?决定?

推荐答案

正如我在上一个回答中评论原因来设置一个这些内存池的限制是不同的。

As I commented on the previous answer the reasons for setting a limit on those memory pools is different.

如果您的用户之前增加 MaxPermSize高于默认值,可能是为了避免Full GCs / concurrent CMS的模式失败,或者因为他们的应用程序真正需要大量的perm gen空间。

If your users previously increased the MaxPermSize above the default that probably was either to avoid Full GCs / concurrent mode failures with CMS or because their applications genuinely needed a lot of perm gen space.

从有效的无限默认值中减少元空间限制将起到完全不同的作用:避免无限的元空间增长。

Decreasing the the metaspace limit from its effectively infinite default would serve an entirely different purpose: Avoiding unbounded metaspace growth.

事情是,这只是一个上限。实际提交的,即当前元空间大小将更小。实际上,有一个名为 MaxMetaspaceFreeRatio 的设置(默认为70%),这意味着实际的元空间大小永远不会超过其占用率的230%。

The thing is that that's just an upper limit. The actually committed, i.e. current metaspace size will be smaller. In fact, there is a setting called MaxMetaspaceFreeRatio (default 70%) which means that the actual metaspace size will never exceed 230% of its occupancy.

并且为了它的增长它首先必须填满,强制垃圾收集(元空间已满)试图释放对象,并且只有当它无法满足其 MinMetaspaceFreeRatio (默认为40%)目标是在GC周期后将当前元空间扩展到不超过占用率的230%。

And for it to grow it first would have to fill up, forcing a garbage collection (metaspace full) in an attempt to free objects and only when it cannot meet its MinMetaspaceFreeRatio (default 40%) goal it would expand the current metaspace to no more than 230% of the occupancy after the GC cycle.

因此在实践中,实际的元空间大小应该稳定在相对于其实际需要的一个带内,除非应用程序不断泄漏类加载器/类或生成大量的动态代码。

So in practice the actual metaspace size should stabilize within a band close relative to its actual need unless the application is continuously leaking classloaders/classes or generating an enormous amount of dynamic code.

TL; DR:可能有理由限制元空间大小,但它们可能与设置perm gen size的原始原因不同。因此,需要重新评估。

TL;DR: There may be reasons to restrict metaspace size, but they likely are different to the original reasons for setting the perm gen sizes. Therefore the need should be re-evaluated.

这篇关于我应该设置MaxMetaspaceSize吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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