LinuxCommandLibrary

jstat

Monitor Java Virtual Machine (JVM) statistics

SYNOPSIS

jstat [ options ] vmid [ interval [count] ]

PARAMETERS

-class
    Displays class loader statistics.

-compiler
    Displays HotSpot compiler statistics.

-gc
    Displays garbage collection statistics.

-gccapacity
    Displays capacities of the garbage collection pools and spaces.

-gccause
    Displays garbage collection statistics with the causes of the last and current GC events.

-gcnew
    Displays statistics of the new generation.

-gcnewcapacity
    Displays capacities of the new generation.

-gcold
    Displays statistics of the old generation.

-gcoldcapacity
    Displays capacities of the old generation.

-gcutil
    Displays garbage collection summary statistics.

-printcompilation
    Displays HotSpot compilation method statistics.

vmid
    Virtual Machine Identifier. Typically the process ID of the Java process.

interval
    The sampling interval in milliseconds.

count
    The number of samples to take. If omitted, jstat will run indefinitely.

DESCRIPTION

jstat is a command-line utility used to monitor Java Virtual Machine (JVM) statistics.
It provides insights into various aspects of the JVM's performance, including garbage collection, compiler behavior, and memory usage.
This tool is valuable for diagnosing performance issues, tuning JVM configurations, and gaining a deeper understanding of how Java applications utilize resources.
It connects to a target JVM and outputs the requested statistics in a tabular format.
Unlike graphical monitoring tools, jstat is lightweight and suitable for use in resource-constrained environments or when remote monitoring is required. Its output can be easily parsed and analyzed by scripts, facilitating automated monitoring and alerting.

CAVEATS

jstat requires sufficient permissions to access the target JVM. The target JVM must have the JMX agent enabled and properly configured. The availability of specific statistics may depend on the JVM version and configuration.

<B>OUTPUT INTERPRETATION</B>

The output of jstat is presented in a tabular format with various columns representing different statistics.
Understanding the meaning of these columns is crucial for interpreting the results. Consult the JDK documentation for a detailed explanation of each column for each option.

<B>EXAMPLE USAGE</B>

jstat -gcutil 1234 1000 10
This command will display garbage collection summary statistics for JVM process 1234, sampling every 1000 milliseconds and taking 10 samples.

HISTORY

jstat was introduced as part of the Java Development Kit (JDK) to provide a command-line interface for monitoring JVM performance.
It has been a standard tool in the JDK for many years, evolving with each Java version to incorporate new features and improvements.
Its simple interface and powerful capabilities have made it a popular choice for developers and system administrators who need to monitor and tune JVM-based applications.

SEE ALSO

jps(1), jinfo(1), jmap(1), jcmd(1)

Copied to clipboard