保持MaxPermSize小有什么好处吗? [英] Are there any benefits to keeping MaxPermSize small?

查看:195
本文介绍了保持MaxPermSize小有什么好处吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设有64位JVM,将MaxPermSize保持为小有什么显着的好处吗?

Assuming a 64-bit JVM, is there any significant benefit to keeping MaxPermSize small?

这是在经常重新部署的Java EE应用程序的上下文中,并有一个classloader泄漏。作为中期解决方案,将MaxPermSize提升到荒谬值似乎是非常合理的 - 只要它不会破坏磁盘交换空间。

This is in the context of a Java EE application that is frequently redeployed, and has a classloader leak. As a medium-term workaround, it seems very reasonable to just bump up MaxPermSize to an absurd value - as long as it won't blow out the disk swap space.

因为取消部署的应用程序的代码几乎全部未使用(除了涉及泄漏的代码),它被操作系统分页。因此,未部署碎屑对物理内存的负担似乎可以忽略不计;通过观察RSS(Unix上的工作集大小)验证了这一点。

Because the undeployed app's code is nearly all unused (apart from that involved in the leak), it's paged out by the operating system. So the load on physical memory from undeployed detritus seems negligible; this has been verified by observing RSS (the working-set size on Unix).

我应该关注其他影响吗?

Are there other effects I should be concerned about?

推荐答案

来自 JVM HotSpot常见问题解答


我应该增加客户端虚拟机中永久代的大小吗?

Should I increase the size of the permanent generation in the client vm?

这将永远是一个判断电话。一般来说,增加一代的大小(这不仅适用于永久代)可以减少各种问题的发生率但是,这可能会导致其他进程过度分页和/或垃圾收集或丢失内存异常。

This will always be a judgment call. In general increasing the size of a generation (and this applies not just to the permanent generation) can reduce the incidence of a wide variety of problems However, this may cause other processes to excessively page and/or garbage collect or throw out-of-memory exceptions.

有两种失败模式需要考虑。

There are two failure modes to consider.

当提升MaxPermSize时,可能是以前的用于垃圾收集以恢复永久生成空间的良好行为程序将因无限的分页而死亡。对于永久性生成,这通常只发生在临时字符串的重度实习中。

When raising MaxPermSize, it is possible that previously well behaved programs that used to garbage collect to recover the permanent generation space will die by endless paging. For the permanent generation this usually only happens with the heavy interning of temporary strings.

另一种失败模式是必须为永久生成保留地址空间,这将减少可用于堆的其余部分(最大-Xmx可能因此太大)。这将导致配置为使用所有可用空间的程序在初始化时失败。

The other failure mode is that address space must be reserved for the permanent generation and this will reduce that available for the rest of the heap (the maximum -Xmx may then be too large). This will cause programs configured to use all available space to fail at initialization.

此外这篇文章说:


所以我们利用通过在收集终生代之前收集永久世代,将类保留在永久世代中。目前永久性一代是连续收集的。

So we take advantage of the fact that classes are kept in the permanent generation by collecting the permanent generation before collecting the tenured generation. And the permanent generation is currently collected serially.

我认为大型永久性代可能会导致更长的GC时间。

Large permanent generation can cause longer time of GC I think.

这篇关于保持MaxPermSize小有什么好处吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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