Tuesday, November 13, 2012

Thread dump & heap dump — Presentation Transcript

https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=2245aa39-fa5c-4475-b891-14c205f7333c


From http://www.slideshare.net/josephamrithraj/thread-dump-heap-dump-4008612

Resources:

Thread dump & heap dump — Presentation Transcript

  • 1. Thread dump & Heap Dump in websphere
  • 2. In this session, What is Thread/Heap dump? When to generate ? How to generate ? How to debug ?
  • 3. Thread Dump
    What is a Thread Dump? A thread represents a work item or task, such as a servlet request. Java processes are usually multi-threaded. This means there can be many tasks occurring simultaneously (multi-threading) within one JVM process. Java thread dumps provide a Java view of a failing JVM process. A Java dump provides information about the executing Java classes and allows the problem determination process to reference the Java source code.
  • 4. When to generate
    If you get unexplained server hangs under WebSphere, you can obtain, from the WebSphere server, a thread dump to help diagnose the problem. In the case of a server hang, you can force an application to create a thread dump. If an application server spontaneously dies, look for a file. The JVM creates the file in the product directory structure, with a name like javacore[number].txt.
  • 5. How to generate
    On unix/Linux machines find the process id (PID) of the hung JVM and issue kill -3 PID. Look for an output file in the installation root directory with a name like javacore.date.time.id.txt. Using wasadminprompt:get the handle of the server wsadmin>set jvm [$AdminControlcompleteObjectName type=JVM,process=server1,*] then execute wsadmin>$AdminControl invoke $jvmdumpThreads
  • 6. Analysis
    Download thread analyzer from IBM website to analyze the generated thread dumps. - http://www.alphaworks.ibm.com/tech/jca
  • 7. Heap Dump
    A heapdump is a snapshot of JVM memory. it shows the live objects on the heap along with references between objects. It is used to determine memory usage patterns and memory leak suspects. When to generate? Memory leaks in the Java heap produce java.lang.OutOfMemoryError exceptions in log files. However, not all out-of-memory errors are caused by Java heap memory leaks. Out-of-memory errors can also be caused by the following conditions: Java heap fragmentation. This fragmentation occurs when no contiguous chunk of free Java heap space is available from which to allocate Java objects. Various causes for this problem exist, including the presence of pinned or dosed objects or because of the repeated allocation of large objects. Memory leaks in native heap. This problem occurs when a native component, like DB2 connections, is leaking.
  • 8. How to generate
    To enable automated heap dump generation support, perform the following steps in the administrative console: (heap dump will generated upon receiving the out.of.memoryexceptios) 1. Click Servers > Application servers in the administrative console navigation tree. 2. Click server_name >Runtime Performance Advisor Configuration. 3. Click the Runtime tab. 4. Select the Enable automatic heap dump collection check box. 5. Click OK. To generate manually use kill -3 PID on unix/linux machines. Using WSADMIN tool Invoke the generateHeapDump operation on a JVMMBean, for example, * Finding JVMobjectName: <wsadmin> set objectName [$AdminControlqueryNamesWebSphere:type=JVM,process=<servername>,node=<nodename>,*] * Invoking the generateHeapDump operation on JVMMBean: <wsadmin> $AdminControl invoke $objectNamegenerateHeapDump
  • 9. Analysis
    heap dumps can be found under profile_rootprofile-name with naming heapdump.<date>..<timestamp><pid>.phdUse HeapAnalyzer or MDD4J for analyzing heap dumps

No comments:

Post a Comment