Solved

moniotring JVM heap size

Posted on 2006-11-30
9
2,794 Views
Last Modified: 2012-06-27
I have a java application that creates a fairfew jvm's on the server it runs on.

What is the best way to measure the utaliseation of each JVM is.

I want to be able to see which JVMs are about to run out of memory in its heap.

are there any trick bits of softwar eout their that that might cater for my need that anyone knows of! ;)

Willa
0
Comment
Question by:willa666
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18051321
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18051327
> are there any trick bits of softwar eout their that that might cater
> for my need that anyone knows of! ;)


Quite simple theory: create an object, when you are done with it make sure that its dereferenced.
0
 
LVL 1

Author Comment

by:willa666
ID: 18051453
Hello Ajay-Singh

will this let me moniotr multiple(20-50) Jvms at once?

I am only concerned with knowing if a JVM is going to run out of memory.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18051657
I think you should - but more than monitoring this tool points out memory leaks and cpu, gc timings.


To monitor only monitoring, you can start the jvm process with jmx enabled and monitor on jmx console. With this you can monitor heap/cpu usage very easily.

More: http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/
0
 
LVL 35

Expert Comment

by:girionis
ID: 18052343
You might also try JProbe SUite (http://www.quest.com/jprobe/) (not free though).
0
 
LVL 5

Expert Comment

by:maclema
ID: 18320970
Here is a little chunk of HTML/JSP I use to monitor my JVM's.
<%!
    String displaySize(long size) {
            long ONE_KB = 1024;
               long ONE_MB = ONE_KB * ONE_KB;
               long ONE_GB = ONE_KB * ONE_MB;
      
        String displaySize;

        if (size / ONE_GB > 0) {
            displaySize = String.valueOf(size / ONE_GB) + " GB";
        } else if (size / ONE_MB > 0) {
            displaySize = String.valueOf(size / ONE_MB) + " MB";
        } else if (size / ONE_KB > 0) {
            displaySize = String.valueOf(size / ONE_KB) + " KB";
        } else {
            displaySize = String.valueOf(size) + " bytes";
        }
        return displaySize;
    }
%>

<div><b>Max. Heap Size:</b> <%= displaySize(Runtime.getRuntime().maxMemory()) %></div>
<div><b>Cur. Heap Size:</b> <%= displaySize(Runtime.getRuntime().totalMemory()+Runtime.getRuntime().freeMemory()) %></div>
<div><b>Used Memory:</b> <%= displaySize(Runtime.getRuntime().totalMemory()) %></div>
<div><b>Free Memory:</b> <%= displaySize(Runtime.getRuntime().freeMemory()) %></div>

Hope that helps

Matt
0
 
LVL 5

Accepted Solution

by:
maclema earned 500 total points
ID: 18320987
Also keep this in mind:

Max Heap is the maximum allowable size that the heap can grow to.

Curr Hear is the currently allocated space that can be used for the heap.

Used Memory is the amount of the current heap that is used.

Free Memory is the amount of space left in the currently allocated heap size.

You will receive an out of memory error once the heap tries to expand past the maximum heap size.

- Matt
0
 
LVL 1

Author Comment

by:willa666
ID: 18323696
Hi maclema:

Is there a list of all the monitoring servlets anywhere on the net?

0
 
LVL 5

Expert Comment

by:maclema
ID: 18335058
What do you mean by a list of monitoring servlets?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
type mismatch (Object[] to double[] 4 41
spring jars download 1 53
null output 3 43
glassfish admin console 1 23
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question