Howto monitor PermGen space usage before redeploying in Tomcat

末鹿安然 提交于 2019-12-24 04:51:43

问题


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

something like:

set myPermGenThreshold = 0.51  (51%)
currentlyUsedPermGenSize = (...ask the jvm here... say it's 0.6)

if (currentlyUsedPermGenSize > myPermGenThreshold ) {
 (...restart tomcat...)
}
else {
  (...redeploy application...)
}

回答1:


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.

Both of these JMX beans are available from the platform server, as usual, so they should be obtainable externally using a JMX client.

Edit - links updated to 1.7.



来源:https://stackoverflow.com/questions/12086703/howto-monitor-permgen-space-usage-before-redeploying-in-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!