JVM: Command Used to view java memory and jvm to view java commands

Source: Internet
Author: User

JVM: Command Used to view java memory and jvm to view java commands

Jinfo: You can output and modify the opts of the java Process at runtime.
Jps: similar to ps on unix, which is used to display local java processes. You can view several java programs running locally and display their process numbers.
Jstat: A Powerful VM memory monitoring tool. It can be used to monitor the size and memory usage of various heap and non-heap volumes in the VM memory.
Jmap: print out all 'objects' in the memory of a java Process (using pid) (for example, generate those objects and their quantity ).
Jconsole: a java GUI monitoring tool that displays various data in tabular form. You can also remotely connect to and monitor remote server VMS.

Details: Before using these tools, use the JPS command to obtain the current JVM process number, and then select the JVM to view.
The jstat tool is extremely powerful and has many options. You can view the usage of each part of the heap and the number of loaded classes in detail. You must add the process id and the selected parameters to view the process. The following describes the meanings of each parameter.
Jstat-class pid: displays the number of loaded classes and the occupied space.
Jstat-compiler pid: displays information such as the number of real-time VM compilations.
Jstat-gc pid: displays gc information, the number of gc times, and the time. The last five items are the young gc count, young gc time, full gc count, full gc time, and total gc time.
Jstat-gccapacity: displays the usage and usage of three generations (young, old, and perm) objects in the VM memory. For example, pgcen displays the minimum perm memory usage, PGCMX displays the maximum memory usage of perm. PGC is the memory usage of the newly generated perm, while PC is the memory usage of the previous perm. For others, the OC usage is pure in old.
Jstat-gcnew pid: information of the new object.
Jstat-gcnewcapacity pid: information about the new object and its usage.
Jstat-gcold pid: information of the old object.
Jstat-gcoldcapacity pid: information about the old object and its usage.
Jstat-gcpermcapacity pid: information of the perm object and its usage.
Jstat-util pid: Statistics of gc information.
Jstat-printcompilation pid: information about the current VM execution.
In addition to the preceding parameter, you can add two numbers at the same time, for example, jstat-printcompilation 3024 250 6 is printed every 250 milliseconds, a total of 6 times, you can also add-h3 to display the title in each of the three rows.

Jmap is a tool that can output all objects in the memory. It can even output heap in the VM in binary format as text.
Command: jmap-dump: format = B, file = heap. bin <pid>
File: Save path and file name
Pid: process ID
• Jmap-histo: live pid | less: Activity object and size in the heap
• Jmap-heap pid: View heap usage information


Jinfo: it is easy to use, that is, to output and modify the runtime parameters of the java Process. The usage is jinfo-opt pid. For example, to view the MaxPerm size of 2788, you can use jinfo-flag MaxPermSize 2788.

Jconsole is a GUI program written in java to monitor VMS and monitor remote VMS. It is easy to use and has powerful functions. Usage: Run jconsole in the command line. Select the process.
Description of memory partitions in JConsole.

Eden Space (heap): the memory is initially allocated to most objects from this thread pool.
Parallel vor Space (heap): an object that is stored in the eden space memory pool and has not been recycled after garbage collection.
Tenured Generation (heap): used to keep objects that have existed in the memory pool of zoovor space for a period of time.
Permanent Generation (non-heap): saves the refective data of the virtual machine, such as class and method objects. Java virtual machines share these types of data. This area is divided into read-only and write-only,
Code Cache (non-heap): the HotSpot Java Virtual Machine includes a memory used to compile and save local code (native code), called "Code cache)

• Jstack: jstack pid: thread dump
• Jstat-gcutil pid 1000 100: 100 ms for one gc statistics times;

MemoryAnalyzer, a memory object tool for viewing jmap dump, is also recommended.
URL: http://www.eclipse.org/mat/. the number of objects can be reached when dumpis are used, memory usage, and thread status.

[Original article address: http://boendev.iteye.com/blog/882479]

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.