Download Generating HeapDump PDF

TitleGenerating HeapDump
TagsJava Virtual Machine Java Programming Language Thread (Computing) Operating System Technology Computer Data
File Size443.3 KB
Total Pages7
Document Text Contents
Page 1

Generating Heap dumps and Thread dumps
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 (Server must start)




Set up for enabling heap dump:



 For V6.0 release:
1. To set the following Environment Entries from the administrative console:

Select Servers > Application Servers >server_name> Java and Process
Management > Process Definition > Environment Entries > New

2. Add the following Name/Value pairs:
IBM_HEAPDUMP true

IBM_HEAP_DUMP true

IBM_HEAPDUMPDIR your_directory

IBM_HEAPDUMP_OUTOFMEMORY true

IBM_JAVADUMP_OUTOFMEMORY true

3. Make sure that you save changes to the master configuration





1.Click Servers > Application servers in the administrative console navigation tree.

Page 2

http://4.bp.blogspot.com/-uD-R0r1olHw/UYtbcGRBd8I/AAAAAAAAAG0/uVZ3C_3xw4A/s1600/blg1.bmp
http://4.bp.blogspot.com/-M_GEcnbzu1s/UYtcGGCs2WI/AAAAAAAAAG8/fAR-kRvRHZE/s1600/blg2.bmp
http://4.bp.blogspot.com/-asWy6hM7Rbs/UYtceF6yeUI/AAAAAAAAAHE/vA5IDJBwEOY/s1600/blg3.bmp
http://2.bp.blogspot.com/-I1gUnbZqxCw/UYtdPIbO84I/AAAAAAAAAHM/XqV390sAzEM/s1600/blg4.bmp
http://4.bp.blogspot.com/-uD-R0r1olHw/UYtbcGRBd8I/AAAAAAAAAG0/uVZ3C_3xw4A/s1600/blg1.bmp
http://4.bp.blogspot.com/-M_GEcnbzu1s/UYtcGGCs2WI/AAAAAAAAAG8/fAR-kRvRHZE/s1600/blg2.bmp
http://4.bp.blogspot.com/-asWy6hM7Rbs/UYtceF6yeUI/AAAAAAAAAHE/vA5IDJBwEOY/s1600/blg3.bmp
http://2.bp.blogspot.com/-I1gUnbZqxCw/UYtdPIbO84I/AAAAAAAAAHM/XqV390sAzEM/s1600/blg4.bmp
http://4.bp.blogspot.com/-uD-R0r1olHw/UYtbcGRBd8I/AAAAAAAAAG0/uVZ3C_3xw4A/s1600/blg1.bmp
http://4.bp.blogspot.com/-M_GEcnbzu1s/UYtcGGCs2WI/AAAAAAAAAG8/fAR-kRvRHZE/s1600/blg2.bmp
http://4.bp.blogspot.com/-asWy6hM7Rbs/UYtceF6yeUI/AAAAAAAAAHE/vA5IDJBwEOY/s1600/blg3.bmp
http://2.bp.blogspot.com/-I1gUnbZqxCw/UYtdPIbO84I/AAAAAAAAAHM/XqV390sAzEM/s1600/blg4.bmp
http://4.bp.blogspot.com/-uD-R0r1olHw/UYtbcGRBd8I/AAAAAAAAAG0/uVZ3C_3xw4A/s1600/blg1.bmp
http://4.bp.blogspot.com/-M_GEcnbzu1s/UYtcGGCs2WI/AAAAAAAAAG8/fAR-kRvRHZE/s1600/blg2.bmp

Page 4

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




Generating Thread 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 Thread dump:


$AdminControl invoke $jvm dumpThreads


OR

use kill -3 PID on unix/linux machines.









Thread Dump:

When we trigger a thread dump on an application server, all active thread information will be dumped

into file which is normally known as thread dump. In this dump file, we can get information about thread

like active thread, hung thread, dead lock, runnable and inactive thread info.

Command to generate thread dump: kill -3 PID_OF_SERVER

When our application server reports the thread hung conditions in SystemOut.log file then we generate

thread dump to analyze the reason behinds thread hungs. We are generally having thread hung situation

when any threads coming to system becomes unresponded.

When Websphere Application Server detects that a thread has been active longer than the time defined by

the thread monitor threshold then it write below error code in SystemOut.log file:

• WSVR0605W: Thread threadname has been active for hangtime and may be hung. There are

totalthreads threads in total in the server that may be hung.

Where: threadname is the name that appears in a JVM thread dump, hangtime gives an approximation of

how long the thread has been active and totalthreads gives an overall assessment of the system threads.

If the above thread gets released by itself then we get below entry in our log file:

• WSVR0606W: Thread threadname was previously reported to be hung but has completed. It was

active for approximately hangtime. There are totalthreads threads in total in the server that still may be

hung.

Page 6

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.










ANALYZING WEBSPHERE THREAD DUMP

We can take thread dump on WAS using wsadmin tool in the following way.

D:\IBM\WebSphere\AppServer\profiles\ProcessCommander\bin>wsadmin.bat

WASX7209I: Connected to process “server1″ on node WKHANFXPNode02 using SOAP conn

ector; The type of process is: UnManagedProcess

WASX7029I: For help, enter: “$Help help”

wsadmin>set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]

WebSphere:name=JVM,process=server1,platform=proxy,node=WKHANFXPNode02,j2eeType=J

VM,J2EEServer=server1,version=6.1.0.0,type=JVM,mbeanIdentifier=JVM,cell=WKHANFXP

Node01Cell,spec=1.0

wsadmin>$AdminControl invoke $jvm dumpThreads

This will create a java core file in the following directory

D:\IBM\WebSphere\AppServer\profiles\ProcessCommander

javacore.20110511.174141.9628.txt

We need to download IBM Thread Dump Analyzer from here

Start the tool using the following command

E:\tools\jca412>java -Xmx515m -jar jca412.jar

Open the thread dump from

http://www.alphaworks.ibm.com/tech/jca/download

Similer Documents