简体   繁体   English

在Tomcat中重新部署之前如何监视PermGen空间使用情况

[英]Howto monitor PermGen space usage before redeploying in Tomcat

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 为了确定下一次重新部署后jvm是否可能会出现permgen空间不足的情况,我想在操作之前监视当前的permgen空间使用情况

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...)
}

The Memory MX Bean will give you all non-heap usage, of which the perm gen is a part. Memory MX Bean将为您提供所有非堆使用,而perm gen是其中的一部分。 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. 可以使用Memory Pool MX Bean获得perm gen池本身的大小,但是请注意,这些池的名称与实现有关,并且与GC有关。

Both of these JMX beans are available from the platform server, as usual, so they should be obtainable externally using a JMX client . 像往常一样,这两个JMX bean都可以从平台服务器上获得,因此应该可以使用JMX client从外部获得它们。

Edit - links updated to 1.7. 编辑-链接更新为1.7。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM