JVM: View Java Memory Condition command

Source: Internet
Author: User
Tags jconsole

Jinfo: You can output and modify the opts of the Java process at runtime.

JPS: Similar to PS on UNIX, used to show the local Java process, you can view the local running a few Java programs, and display their process number.
Jstat: A very strong monitoring VM memory tool. can be used to monitor the size of various heap and non-heap sizes and their memory usage within VM memory.
Jmap: Prints out all the ' objects ' in the memory of a Java process (using PID) (for example, which objects are produced, and their number).
Jconsole: A Java GUI monitoring tool that can display a variety of data in a tabular format. Remote server VMS can be monitored through remote connections.

Verbose: Use the JPS command to get the current per-JVM process number before using these tools, and then select the JVM you want to view.   the
Jstat tool is particularly powerful and has a number of options to view in detail the usage of each part of the heap, as well as the number of loaded classes. When used, add the process ID of the viewing process and the selected parameters. The meanings of each parameter are described in detail below.  
Jstat-class PID: Displays information such as the number of loaded classes, and the amount of space occupied.  
Jstat-compiler PID: Displays information such as the number of real-time VMS compiled.  
JSTAT-GC PID: can display GC information, view GC number of times, and time. The last five items were the number of young GC, the time of young GC, the number of full GC, the time of full GC, and the total time of GC.  
Jstat-gccapacity: You can display the usage and occupancy of three-generation (Young,old,perm) objects in VM memory, such as: PGCMN shows the minimum perm of memory usage, PGCMX shows the maximum memory usage of perm, the PGC is the current newly generated perm memory footprint, the PC is but the pre-perm memory footprint. The other can be based on this analogy, OC is the old inside the pure consumption.  
Jstat-gcnew information for Pid:new objects.  
Jstat-gcnewcapacity the information and consumption of Pid:new objects.  
Jstat-gcold information for Pid:old objects.  
Jstat-gcoldcapacity the information and consumption of Pid:old objects.  
Jstat-gcpermcapacity the information and consumption of Pid:perm objects.  
Jstat-util PID: Statistics GC information statistics.  
Jstat-printcompilation PID: Information that is being performed by the current VM.  
In addition to one of the above parameters, you can also add two numbers, such as: Jstat-printcompilation 3024 250 6 is printed every 250 milliseconds, printing 6 times, you can add-h3 every three lines to display the title.

Jmap is a tool that can output all in-memory objects, and even the heap in the VM can be output as text in binary.
Command: Jmap-dump:format=b,file=heap.bin <pid>
File: Save path and file name
PID: Process number
? jmap-histo:live pid| Less: The object and size of the activity in the heap
? jmap-heap pid: View heap usage information


Jinfo: The utility is simple enough to output and modify the runtime parameters of the Java process. Usage is jinfo-opt pid such as: View 2788 of the maxperm size can be used Jinfo-flag maxpermsize 2788.

Jconsole is a GUI program written in Java that monitors VMS and monitors remote VMS, is very easy to use, and is very powerful. How to use: Command line to play Jconsole, select the process is OK.
A description of the memory partition in the Jconsole.

Eden Space: Memory is initially allocated to most objects from this thread pool.
Survivor Space (heap): Used to hold objects that have not been reclaimed after garbage collection in the Eden Space memory pool.
Tenured Generation (heap): Used to hold objects that have been in the Survivor space memory pool for some time.
Permanent Generation (NON-HEAP): Saves the virtual machine's own static (refective) data, such as class and method objects. Java Virtual machines share these class data. This area is divided into read-only and write-only,
Code cache (NON-HEAP): The HotSpot Java Virtual machine includes a memory for compiling and saving the local code (native code), called the "Codes cache"

? Jstack (see the JVM thread running state, deadlock phenomenon, etc.): Jstack pid:thread Dump
? jstat-gcutil PID 100:1000MS statistical GC Statistics 100 times;

Also recommend a Memory object tool to view Jmap dump Memoryanalyzer
URL:http://www.eclipse.org/mat/, you can see the number of objects at dump, memory consumption, thread conditions and so on.

"Original address: http://boendev.iteye.com/blog/882479"

JVM: View Java Memory Condition command

Related Article

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.