JVM generates Javacore and Heapdump filesIn server-side development and operations, it is often necessary to generate javacore and heapdump files to analyze the running state of the JVM. The details of the JVM thread are given in the Javacore file, and the Heapdump file gives the runtime memory usage of the JVM, which plays an important role in analyzing the JVM's memory leaks. Where the Javacore file is generally a text file, while Heapdump is generally a binary file that needs to be analyzed using specialized analysis tools, the commonly used tool is IBM's heap Anylizer.
Javacore is about the CPU, and the Heapdump file is about memory.
The Javacore file primarily holds the location where the Java application's threads run at a certain point, that is, which class the JVM executes on, which method, and on which line. It is a text file that opens after you can see the execution stack of each thread, to stack trace display. Through the analysis of the Javacore file can get the application whether "card" at a certain point, that is, at a certain point of time to run too long, such as database queries, long-term failure to respond, resulting in system crashes and so on.
The Heapdump file is a binary file that preserves the use of objects in the JVM heap at some point, which requires tools for analysis, such as IBM Heap Analyzer. The most important function of this type of file is to analyze whether there is a memory overflow in the system.
(1) Oracle JVMIf you are using an Oracle JVM that is the standard sun JVM (Sun has been acquired by Oracle) when memory overflows, the generated Heapdump file is configured as follows
1 -xloggc:${directory}/temp_gc.log (GC log file)2 -xx:+heapdumponoutofmemoryerror (Generate Heapdump file when memory overflow)3 -xx:heapdumppath=${Directory} (heapdump file storage location)
If you want to generate Heapdump files dynamically, you can use the Jmap command.
jdk6.0 has canceled the way-xx:+heapdumponctrlbreak configuration parameters are passed Ctrl+break.
1 jmap-dump:format=b,file
The Javacore file generation, however, relies on the kill command to generate the Javacore file when the JVM process is killed.
(2) HP JVMcommand-line arguments related to generating heapdump:
1 -xverbosegc:file=${directory}/temp_gc.log (GC log file)2 -xx:+ Heapdumponoutofmemoryerror (Generate Heapdump file when memory overflow)3 -xx:+heapdumponctrlbreak (can be CTRL + Break key combination dynamically generate Heapdump files does the HP JVM cancel this way in Jdk6?? )4 -xx:heapdumppath=${Directory} (heapdump file storage location)
(3) IBM JVM
In a non-Windows operating system environment
1 -xverbosegclog: ${directory}/temp_gc.log (GC log file)2-xdump:heap: Events=user, file=${directory}/pid%uid%pid.phd
Indicates that dump files can be generated by kill-3 as needed,%uid and%pid are variables
In the Windows operating system environment: Start Wsadmin and enter the Wsadmin environment
1 wsadmin> set JVM [$AdminControl completeobjectname TYPE=JVM,process=server1,*] 2$AdminControl$JVM generateheapdump3$ Admincontrol$JVM dumpthreads
The above is mainly through the command line, configuration using the KILL command to generate Javacore and heapdump files.
Summarize:
In a Linux environment, use the PS-EF or Ps-aux command, or the top command, to get the PID and then use the KILL command to kill a particular process, resulting in a Java core and heap dump file. The KILL command is the user sending signal to the process.
Reference documents:
Http://www.codeceo.com/article/java-javacore-heapdump.html
http://blog.itpub.net/14710393/viewspace-754416
In-depth JVM series (3): Javacore and Heapdump