VMware Cloud Community
bkeyser_hyperic
Contributor
Contributor

Measuring Java heap space

The JMX capability show the amount of heap space free for the VM. Is there a way to get the amount of heap spaced used? This would be valuable information for an alert that would show when the VM is approaching the upper bound using the value set in the -Xmx flag when the VM is started.
0 Kudos
3 Replies
excowboy
Virtuoso
Virtuoso

Hi,

according to
http://support.hyperic.com/display/hypcomm/Sun+JVM+1.5+server

Heap Memory Used is a supported metric, even though it is not enabled by default

To enable this metric for all your JVMs please refer to:
http://support.hyperic.com/display/DOC/ui-Admin.Monitor.MetricTemplate

Cheers,
Mirko
0 Kudos
jvalkeal_hyperi

Mirko, I think original poster was asking whether HQ could define alert condition as correlation from one metric to other. Like if metricA is lower that metricB. Have you heard whether hyperic is planning to do features like this?

As Mirko said, 'Heap Memory Used' could be used to track if memory is getting full. Of course you need to manually set the max value to alert condition.

I guess it could be technically possible to create new custom metric to track 'Total Free Heap Size'. This metric would subtract used mem from max mem. This needs some java coding, thought.

Default 'Heap Memory Free' will only give free mem from the already allocated heap size. And if Xmx and Xms differs, free heap metric doesn't tell the whole truth. Jvm could be started by defining same values to Xmx/Xms parameters, then default free heap mem should give much reliable results.
0 Kudos
bkeyser_hyperic
Contributor
Contributor

Hi jvalkeal,

Yes, you are are correct. The method used with the heap space free does not allow us to bound the limit and create an appropriate alert as the value will change.

This would be most helpful for monitoring.

Thanks,
Brian
0 Kudos