Question

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...)
}
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top