Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

moniotring JVM heap size

Posted on 2006-11-30
9
Medium Priority
?
2,799 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
Independent Software Vendors: 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 2000 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

604 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