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.

detail: Before using these tools, use the JPS command to get the current per-JVM process number, 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 the number of loaded classes, and the amount of space that is 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: It can be shown that the use and occupancy of three generation (Young,old,perm) objects in VM memory, such as: PGCMN shows the minimum perm memory usage, PGCMX shows the maximum amount of memory used for Perm, The PGC is the current newly generated perm memory footprint, and 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 The information for the Pid:new object.
jstat-gcnewcapacity The information of the Pid:new object and its consumption.
Jstat-gcold The information for the Pid:old object.
jstat-gcoldcapacity The information of the Pid:old object and its consumption.
jstat-gcpermcapacity The information of the Pid:perm object and its consumption.
jstat-util PID: Statistical GC information statistics.
jstat-printcompilation PID: Information for the current VM execution.
In addition to one of the above parameters, you can also add two numbers at the same time, such as: Jstat-printcompilation 3024 250 6 is printed every 250 milliseconds, a total of 6 times, you can add-h3 every three lines to display the title.

command: jmap-dump: Format=b,file=heap.bin <pid> 
file: Save path and file name  

?jmap- histo:live  pid| Less: The active object in the heap and the size  
?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 (view JVM thread run state, Whether there is deadlock phenomenon and so on): Jstack pid:thread dump 
?jstat-gcutil  pid  100 : 1000ms statistics GC case statistics 100 times;

Also recommend a Memory object tool to view Jmap dump Memoryanalyzer
Website: http://www.eclipse.org/mat/ , you can view the number of objects at dump, memory consumption, thread condition, etc.


JVM: View Java Memory Condition command

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.