Solved

moniotring JVM heap size

Posted on 2006-11-30
9
2,786 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
  • 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now