Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to monitor memory usage and allocation for Java?

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?

1 vote

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.



4 answers

Permanent link
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.


2 votes


Permanent link
Did you try took look at the working set used by your java process (task mgr. or top/vmstat on linux)

0 votes

Comments

Well, the java.exe process in Windows only seems to show how much has been allocated to Java, as it keeps increasing with every operation. I've also noticed that it actually increases somewhat when no operation is done at all: I closed the browser and the java.exe process kept increasing. What I'm interested in is how much memory is used for each operation.

There is no simple way to monitor this, given that Java's gc may run at anytime, not to mention the heap allocation algorithm... it does not always goes down after it is ratched up.


Permanent link
If you have a RAM server handy, you can drop some widgets from it (Look at the extension page)


0 votes

Comments

Would you mind expanding on this a bit? Where can I find a RAM server and how do I use it in this context?


Permanent link
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.


0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 7,606
× 6,174

Question asked: Oct 08 '12, 10:38 a.m.

Question was seen: 13,985 times

Last updated: Oct 18 '12, 4:19 a.m.

Confirmation Cancel Confirm