7.4.  Perform JVM troubleshooting tasks (e.g., thread dump, JVM core dump, and heap dump, verbose Garbage Collection (GC)).

[Note]

Generating a Java heap dump

A Java heap dump is an IBM software development kit (SDK)-generated data file containing a snapshot of the current memory state of the application server JVM. A Java heap dump is generated automatically when the JVM runs out of memory.

To issue a command to generate a heap dump in wsadmin.sh, you must first obtain a reference to the message bean (MBean) that is associated with the JVM running in your process using the command that is shown below:

jvm = AdminControl.queryNames("WebSphere:type=JVM,process=server1,node=devNode,*")
AdminControl.invoke(jvm, 'generateHeapDump')					
					

Afterward, use the following command to induce the Java heap dump:

AdminControl.invoke(jvm, 'generateHeapDump');
					

Generating Java core dump

The Java core dump is a IBM SDK-generated data file, which contains information pertaining to the threads and monitors in the JVM. Just as the Java heap dump is a snapshot of the process JVM memory, the Java core dump is a snapshot of the threads running on the JVM. This data file is generated automatically every time that a server crashes. Or, a user can issue a command to generate this data file.

To issue a command to generate a core dump in wsadmin, you must first obtain a reference to the MBean that is associated with the JVM running in your process using the command shown below:

jvm = AdminControl.queryNames("WebSphere:type=JVM,process=server1,node=devNode,*")
AdminControl.invoke(jvm, 'dumpThreads')
					

Afterward, use the following command to start the Java core dump:

AdminControl.invoke(jvm, 'dumpThreads');
					

Locating and analyzing heap dumps

Do not analyze heap dumps on the WebSphere Application Server machine because analysis is very expensive. For analysis, transfer heap dumps to a dedicated problem determination machine.

When a memory leak is detected and heap dumps are generated, you must analyze heap dumps on a problem determination machine and not on the application server because the analysis is very central processing unit (CPU) and disk I/O intensive.

Perform the following procedure to locate the heap dump files:

  1. On the physical application server where a memory leak is detected, go to the WebSphere Application Server home directory. The directory is:

    WAS_install_root/profiles/profile_name								
    								

  2. IBM heap dump files are usually named in the following way:

    
    heapdump.<date>.<timestamp>.<pid>.phd
    								
    								

  3. Gather all the .phd files and transfer them to your problem determination machine for analysis.

  4. Many tools are available to analyze heap dumps that include Rational Application Developer 7.5. WebSphere Application Server serviceability released a technology preview called Memory Dump Diagnostic For Java (MDD4J). You can download this preview from the product download Web site.

Professional hosting         Free 'Oracle Certified Expert Web Services Developer 6' Guide     Free SCDJWS 5.0 Guide