File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes Heap Memory usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Heap Memory usage" Watch "Heap Memory usage" New topic
Author

Heap Memory usage

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 759
Hi i have a web application deployed on 2 different machine.

I've run the same setup of jdk and tomcat on both the machines, but when i look at the heap usage on both the machine, on one machine heap memory usage and GC activity runs fine, but on other machine, heap memory usage n GC Activity i found it inefficient. and ultimately my jvm goes down.

What could be the issue... ?


Jigar Naik


arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3250
Are these two machines clustered or load balanced? Make sure that the load is balanced properly. Did you compare the JVM arguments in both boxes? Did you check that your JVM has started with the actual supplied minimum memory (if you have any error in the script or config it may have been ignored)?


500+ Java Interview Questions and Answers | Java job hunting know how & Java resumes
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 759
Thanks for your valuable inputs.

but Sorry, I don't know much about JVM.
From where can i check the JVM parameters ?

No my JVM doesn't start with actual supplied min memory.

This is what i have set in the service.bat of tomcat/bin.
So i guess my jvm should start with 32 mb commited memory right ?

I am using JProfiler to monitor.

and if there is any issue in allocating memory how do i fix it. like my jvm is not allocating 32 mb of committed memory while tomcat start up that's what i have observed.

please help me solving this issue.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

It's not a bad idea to do a memory analysis. One situation where this kind of situation may occur is is one of the machines is getting hit by unusual circumstances.

I once inherited a program from someone who shall remain nameless. He assumed that everything was going to work perfectly all the time and never coded finally-clauses to catch and clean up after database operations. Over time, of course, this can end up in leaking out not only memory, but network sockets. Eventually, of course, the app would crash.

His motto was "we don't have time to do it right, but we always have time to reboot." Sadly, he's not unique.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 759
my code is clean and every database operataion is enclised with try catch and finally block.

but whay the same code/application is running perfactly on my laptop. but not on actual server.

Is there any dependecy for GC, like OS,Processor or something... can we set the GC policy ?
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Go through this document Memory Management in the Java to have a better understanding about JVM memory management and defaults for each platform, which can vary for OS/hardware.


My Blog
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 759
ok. thanks a lot.
thanks a lot all..
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

Originally posted by Jigar Naik:
my code is clean and every database operataion is enclised with try catch and finally block.


My problem is usually when every database operation it enclosed ... except one. Slow leak.

Which is one of the reasons I like the Spring Framework.
[ October 02, 2008: Message edited by: Tim Holloway ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Heap Memory usage