Deep understanding of Java Virtual Machine---Virtual machine tools JPS and Jstat (14)

Source: Internet
Author: User

Jps-java process Status

JPS is similar to the Linux PS command for viewing processes.

JPS Name: Jps-java Virtual Machine Process Status Tool

command usage: JPS [Options] [HostID]

Options: Command option to control the output format

HostID: Specify a specific host, which can be an IP address and a domain name, or specify a specific protocol, port.

[Protocol:] [[//]hostname] [:p ORT] [/ServerName]

function Description: JPS is the process used to view the hotspot virtual machines that have access to them. When HostID is not specified, the native JVM process is viewed by default, and no person views the JVM process on the specified HostID machine, at which point the HostID machine must turn on the JSTATD service. JPS can list JVM process Lvmid, main class class name, main function parameter, JVM parameter, jar name and other information.

Command options and Features:

When option is not added, the VM designator symbol and the simple class or jar name are listed by default.

-P: Displays only VM markings, does not display Jar,class, main parameters and other information.

-M: Outputs the parameters passed in by the main function. The following hello is the parameter entered from the command line when executing the program

-L: The full package name or jar full name of the output application main class.

-V: Lists JVM parameters,-xms20m-xmx50m is the JVM parameter specified by the initiator

-V: Outputs the JVM parameters specified by. Hotsportrc or-xx:flags=<filename>

-joption: Pass parameters to the Java lancher called by Javac.

Instance:

Jstat


To determine if the JVM has memory problems? How can I tell if the JVM garbage collection is normal? The general top instruction basically does not satisfy this requirement, because it mainly monitors the overall system resources, it is difficult to locate the Java application.

Jstat is a lightweight gadget that comes with the JDK. The full name "Java Virtual machine Statistics monitoring Tool", which is located in the Java Bin directory, mainly uses the JVM built-in instructions for Java application resources and performance of real-time command line monitoring, including the heap Monitoring of size and garbage collection status. Visible, Jstat is a lightweight, JVM-specific tool that works well. The percentage change in the graph is less noticeable due to the large JVM memory settings

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.

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.

Execution: cd $JAVA _home/bin in the execution of Jstat, note that after Jstat must be followed by parameters.

1. Introduction

Jstat is used to monitor the hotspot-based JVM for real-time command-line statistics on the use of its heap, and with jstat we can monitor the specified JVM as follows:

  • Loading and unloading of classes
  • View capacity and usage of new generation, Laosheng and Metaspace
  • View garbage collection in the new generation, Laosheng generation and metaspace, including the number of garbage collections and the time taken by the garbage collector
  • View capacity and distribution in the new generation of Eden and Survior areas

    The Jstat tool is particularly powerful and has a multitude of options, allowing us to understand the current JVM heap usage from different dimensions by providing a variety of different monitoring dimensions. View the usage of each part of the heap in detail, using the Java process number to be counted, the different dimension parameters, and optional statistical frequency parameters.

  • 2. Syntax

    Here are the options supported by jdk1.8:

    The following are the supported options for the following versions of jdk1.8:

    3 Example
    jstat  -gc -h5  -t 26316 1s 20
      • 1
      • 2

    -GC Options
    -H5 display headers every 5 lines
    -T displays the time interval unit that starts at the current time from the virtual machine: seconds
    26536 thread ID
    1s 1 sec. display once
    20 showing 20 times in total

    4 Table Head Explanation

    Real name jdk1.7 and jdk1.8 on a metaspace area, the others are the same.

    Table Header Description JDK version
    s0c The size of S0 current capacity in Survivor space in the Cenozoic (KB)
    S1c The size of S1 current capacity in Survivor space in the Cenozoic (KB)
    s0u S0 capacity usage in survivor space in the Cenozoic (KB)
    T12 S1 capacity usage in survivor space in the Cenozoic (KB)
    EC Eden Space Current capacity size (KB)
    EU Eden Space capacity usage size (KB)
    Oc Old space Current capacity size (KB)
    OU Old space uses the size of the capacity (KB)
    Pc Permanent Space Current capacity size (KB) 1.8 or less
    Pu Size of Permanent space using capacity (KB) 1.8 or less
    Mc Metespace size of current capacity (KB) 1.8 and above
    MU Metespace size of Use capacity (KB) 1.8 and above
    Ccsc Compression class space Size (KB) 1.8 and above
    Ccsu Compression class space Size (KB) 1.8 and above
    Ygc Number of young GC occurrences from application startup to sampling
    Ygct The time (in seconds) that the young GC took from the application startup to sampling
    FGC Number of full GC occurrences from application startup to sampling
    Fgct The time (in seconds) spent in full GC from application startup to sampling
    GCT Total time (in seconds) used for garbage collection from JVM boot to sampling, with a value equal to YGC+FGC

Deep understanding of Java Virtual Machine---Virtual machine tools JPS and Jstat (14)

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.