How to monitor memory usage and allocation for Java?
Sandra Bernspang (15●2●5●8)
| asked Oct 08 '12, 10:38 a.m.
JAZZ DEVELOPER edited Oct 08 '12, 10:41 a.m.
Is there any way I can monitor how much memory is allocated to Java and more importantly, how much memory is being used by Java? Is there a built-in monitor? If not, what external tool would you recommend?
|
4 answers
You can turn on JMX monitoring at the application server level. Here are the java JVM options I use to turn it on (no password...)
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=1099 I use this with both WebSphere application server as well as Tomcat successfully in all versions of CLM. I have integrated this with logicmonitor.com's SaaS monitoring very successfully to show online dashboards of what is going on in the server. Here is a demo that we use at oncloudone.net: https://oncloudone.logicmonitor.com/santaba/uiv2/onegadgets/index.jsp?c=oncloudone&u=demo&p=demo Username: demo Password: demo All too often people forget to tune their Java settings and end up throwing a lot more hardware (CPU power) when all that is needed is a few JVM tweaks to prevent the garbage collection from running too often. |
For high level heap usage, you can simply look into the Jazz application admin page, eg: <host>/jts/admin: it will show the VM memory usage.
Another useful JVM option is to enable verbose GC (adding option -verbose:gc on JVM command line), it will log GC activity, and there are tools helping visualize it and notice memory levels, GC pauses etc... JMX (suggested above) is another good option. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Are you talking about java allocation by the server? I guess I need a little more information on your specific use case.
I'd like to understand how much memory is being used by Java. I've set the Java heap size to 6 GB, but I'd like to understand if that is actually too much or too little to get good performance. I was thinking that some statistics on how much memory is actually used while the server is up and running, I could determine that.
And to clarify, I don't refer to how much is allocated, though such statistics would also be interesting to look at.