问题描述
限时送ChatGPT账号..为了确定在下一次重新部署后 jvm 是否可能会遇到 permgen 空间短缺,我想事先监视当前的 permgen 空间使用情况
In order to decide if the jvm is likely to run into a permgen space shortage after the next redeplyoment I'd like to monitor the current permgen space usage before hand
类似:
set myPermGenThreshold = 0.51 (51%)
currentlyUsedPermGenSize = (...ask the jvm here... say it's 0.6)
if (currentlyUsedPermGenSize > myPermGenThreshold ) {
(...restart tomcat...)
}
else {
(...redeploy application...)
}
推荐答案
Memory MX Bean 将为您提供所有非堆使用,其中 perm gen 是其中的一部分.烫发池本身的大小应该可以使用 Memory Pool MX Bean,但请注意池的名称是实现和 GC 相关的.
The Memory MX Bean will give you all non-heap usage, of which the perm gen is a part. The size of the perm gen pool itself should be available using the Memory Pool MX Bean, but be aware that the names of the pools are implementation and GC-dependent.
像往常一样,这两个 JMX bean 都可以从平台服务器获得,因此它们应该可以使用 JMX 客户端.
Both of these JMX beans are available from the platform server, as usual, so they should be obtainable externally using a JMX client.
编辑 - 链接更新至 1.7.
Edit - links updated to 1.7.
这篇关于在 Tomcat 中重新部署之前如何监控 PermGen 空间使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论