Java core dump and heap dump files

Source: Internet
Author: User
Tags sorts websphere application server

Http://www.cnblogs.com/xzpp/archive/2011/10/10/2206619.html

1. Core dump and heap dump files

Core Dump
Stores CPU and JVM-related information. It mainly stores the running position of each Java application thread at a certain time point, that is, the method of the class to which the execution is performed and the line. Javacore is a text file. Once opened, the execution stack of each thread is displayed in stacktrace mode. Through the analysis of javacore, You can see whether the application is "stuck" at a certain point, that is, the running time at a certain point is too long, such as database query, and the response is not received for a long time, leading to system crash.

 

 

Heap dump
Saves the memory usage of the Java program. The heapdump file is a binary file that stores the objects in the JVM heap at a certain time. This type of file needs to be analyzed by a corresponding tool, using the heap analyzer tool. The most important role of this file is to analyze whether the system has memory overflow. The heapanalyzer can easily analyze the overflow location.

 

Run the kill-3 <pid> command on Linux/Unix to generate the javacore file and heapdump file.

 

 

 

2. Core dump and heap dump analysis tools
Core Dump analysis tool: IBM thread and monitor dump analyze
Heap dump analysis tool: mdd4j or heap analyzer.

Other tools: visualvm, netbeans or eclipse's memory analyzer tool

// Add an analysis instance to todo

3. Reprinted an article about core dump and heap dump.
From introduction to heap dump & core dump

 

 

Core dump and heap dumps:

 

AJava CoreIs a snapshot of the threads at work in a JVM. it also details a cross section of information from the major components in the JVM like XM, XE, LK, etc (IBM javacore only, Sun does not-it just shows threads)

 

A Java dump, also known as a Java core, Java thread dump, or a thread dump is a file that contains the following sewing:

 

  • All of the threads that run on a Java Virtual Machine (JVM ).

 

  • All of the monitors on a JVM.

 

  • Some useful information about the system that the JVM runs under.

 

AHeapdumpIs 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.

 

Generating dumps:

 

Both can be created by issuing a kill-3 on the PID of the JVM process. There are other ways to gather these docs as well (wsadmin scripts)

 

If the kill command does not produce the dumps, you can always generate one with a jacl/Jython script via the wsadmin Interface

 

Jacl

 

Set JVM $ admincontrol completeobjectname type = JVM ,*

 

$ Admincontrol invoke $ JVM dumpthreads

 

Set JVM $ admincontrol completeobjectname type = JVM ,*

 

$ Admincontrol invoke $ JVM generateheapdump

 

Jython

 

JVM = admincontrol. completeobjectname ('Type = JVM, process = server1 ,*')

 

Admincontrol. Invoke (JVM, 'dumpthreads ')

 

The heapdump and a javacore shocould be created in the WebSphere/appserver directory. You can confirm this by reviewing the verbose GC output after issuing the kill command.

 

Threadanalyzer:

 

 

 

  • Threadanalyzer is a problem determination tool for WebSphere Application Server thread performance and Deadlock Detection. you can use it to obtain a Java dump from an application server and use its analysis features for problem determination. for performance problem determination, threadanalyzer provides a top-of-the-stack (ToS) analysis that counts all of the methods at the top of the stack for the listed threads.

 

  • It then sorts them by 'weight '(automatically computed by threadanalyzer), and lists the possible performance bottlenecks in your application. threadanalyzer does automatic Deadlock Detection while it analyzes the Java dump.

 

Downloading threadanalyzer

 

To download threadanalyzer go

 

Http://www.ibm.com/developerworks/websphere/downloads/thread_analyzer.html

 

What is IBM thread and monitor dump analyzer for Java?

 

  • During the run time of a Java Process, some java virtual machiness (JVMs) may not respond predictably and oftentimes seem to hang up for a long time or until JVM shutdown occurs. it is not easy to determine the root cause of these sorts of problems.

 

  • By triggeringJavacoreWhen a Java Process does not respond, it is possible to collect diagnostic information related to the JVM and a Java application captured at a participant point during execution. for example, the information can be about the operating system, the application environment, threads, native stack, locks, and memory. the exact contents are dependent on the platform on which the application is running.

 

  • On Some platforms, and in some cases, javacore is known as "javadump. "The Code that creates javacore is part of the JVM. one can control it by using environment variables and run-time switches. by default, a javacore occurs when the JVM terminates unexpectedly. A javacore can also be triggered by sending specific signals to the JVM. although javacore or javadump is present in Sun Solaris JVMs, much of the content of the javacore is added by IBM and, therefore, is present only in IBM JVMs.

 

  • IBM thread and monitor dump analyzer for Java analyzes javacore and diagnoses monitor locks and thread activities in order to identify the root cause of hangs, deadlocks, and resource contention or monitor bottlenecks.

 

How does it work?

 

  • This technology analyzes each thread information and provides diagnostic information, such as current thread information, the signal that caused the javacore, Java heap information (maximum Java heap size, initial Java heap size, garbage Collector counter, allocation failure counter, free Java heap size, and allocated Java heap size), number of runnable threads, total number of threads, number of monitors locked, and deadlock information.

 

  • In addition, IBM thread and monitor dump analyzer for Java provides the recommended size of the Java heap cluster (applicable only to ibm sdk 1.4.2 and 1.3.1 sr7 or abve) based on the heuristic analysis engine.

 

  • IBM thread and monitor dump analyzer for Java compares each javacore and provides process ID information for threads, time stamp of the first javacore, time stamp of the last javacore, number of garbage collections per minute, number of allocation failures per minute, time between the first javacore and the last javacore, number of Hang suspects, and list of Hang suspects.

 

  • This technology also compares all monitor information in javacore and detects deadlock and resource contention or monitor bottlenecks, if there are any.

 

What is heapanalyzer?

 

  • Heapanalyzer allows the finding of a possible Java heap leak area through its heuristic search engine and Analysis of the Java heap dump in Java applications.

 

  • Java heap areas define objects, arrays, and classes. when the garbage collector allocates areas of storage in the heap, an object continues to be live while a reference to it exists somewhere in the active state of the JVM; therefore the object is reachable. when an object ceases to be referenced from the active state, it becomes garbage and can be reclaimed for reuse.

 

  • When this reclamation occurs, the garbage collector must process a possible finalizer and also ensure that any internal JVM resources that are associated with the object are returned to the pool of such resources. java heap dumps are snap shots of Java heaps at specific times.

 

How does it work?

 

Heapanalyzer analyzes Java heap dumps by parsing the Java heap dump, creating directional graphs, transforming them into directional trees, and executing the heuristic search engine.

 

The following are examples of features:

 

  • List of Java heap leak suspects

 

  • Recommendation of the size of kcluster

 

  • List of gaps among allocated objects/classes/Arrays

 

  • Java objects/classes/arrays Search Engine

 

  • List of objects/classes/arrays by type name

 

  • List of objects/classes/arrays by Object Name

 

  • List of objects/classes/arrays by address

 

  • List of objects/classes/arrays by size

 

  • List of objects/classes/arrays by size of child

 

  • List of objects/classes/arrays by number of child

 

  • List of objects/classes/arrays by Frequency

 

  • List of available heap spaces by size

 

  • Tree View of Java heap dump

 

  • Loading/saving processed Java heap dumps.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.