Sunday 9 September 2012

Heap Dumps generation



Heap Dumps
Heap dump is a text file which keeps record of all objects in the java heap. It contains the information like size and address of all objects, as well as the addresses of all objects that it references.

Heap dump is nothing but a snap shot of our JVM’s Heap memory,contains all active java objects and their activities which object doing what and how much memory it is occupying.

whenever OutOfMemoryException occurs Websphere application Server creates heap dump in profile's home directory.

It is useful in situations, most notable for memory leak problems or memory allocation problems for exaple OutOfMemoryExceptions.

Automated heap dump generation

Click Servers > Application servers in the administrative console navigation tree.
Click server_name >Performance and Diagnostic Advisor Configuration.
Click the Runtime tab.
Select the Enable automatic heap dump collection check box.
Click OK.

Generating Heap dump Manually

set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]
Where server1 is the name of application server for which we want heapdump.
For generating heap dump:
$AdminControl invoke $jvm generateHeapDump.


In order to manually generate a heapdump, you must first enable signal-based heapdumps by setting the IBM_HEAPDUMP=TRUE and IBM_NOSIGHANDLER=TRUE environmental variables.

What is the effect of changing max heap and min heap size of a jvm
                             Max Heap Size: When you have established the maximum heap size that you need,  you might want to set the minimum heap size to the same value;  Using the same values is not usually a good idea, because it delays the start of garbage collection until the heap is full. The first time that the Garbage Collector runs, therefore, becomes a very expensive operation. Also, the heap is more likely to be fragmented and require a heap compaction. Again this is a very expensive operation.
                             Min Heap Size: The recommendation is to start your application with the minimum heap size that it needs. When it starts up, the Garbage Collector will run often and, because the heap is small, it runs efficiently.

Whats the max heap allowed by AIX
                             Minimum heap size allowed
                             AIX:             16 MB
                             LINUX:          16MB
                             WINDOWS:    16 MB

                             Maximum heap size allowed
          AIX: Half the available memory with a minimum of 16 MB and a maximum of 512 MB
          LINUX:          Half the available memory with a minimum of 16 MB and a maximum of 512 MB
          WINDOWS: Half the real (physical or RAM) memory with a minimum of 16 MB and a maximum of 2 GB

What are the effects of large initial heap/max heap
                   The time between garbage collections will increase, but the garbage collection will take longer, which indirectly effects the turn-around-time of the applicaiton performance.
                                                (or)
                             Because it delays the start of garbage collection until the heap is full. The first time that the Garbage Collector runs, therefore, becomes a very expensive operation. Also, the heap is more likely to be fragmented and require a heap compaction. Again this is a very expensive operation.




No comments:

Post a Comment