Thursday, March 14, 2013

Jstat command is a Java Virtual Machine Statistics Monitoring Tool.
The jstat tool displays performance statistics for an
instrumented HotSpot Java virtual machine (JVM). Man page of jstat command
is also useful to get idea about this command. The target JVM is identified by
its virtual machine identifier.

SYNOPSIS

jstat [ generalOption |
outputOptionsvmid [interval[s|ms] [count]] ]

PARAMETERS

generalOption :

A single general command-line option (-help, -options,
or -version)

outputOptions:

One or more output options, consisting of a single
statOption, plus any of the -t, -h, and -J options.

vmid

Virtual machine identifier, a string indicating the
target Java virtual machine (JVM). The general syntax is

[protocol:][//]lvmid[@hostname[:port]/servername]

The syntax of the vmid string largely corresponds to
the syntax of a URI. The vmid can vary from a simple integer
representing a local JVM to a more complex construction specifying
a communications protocol, port number, and
other
implementation-specific values. See
Virtual Machine Identifier
for details.

interval[s|ms]

Sampling interval
in the specified units, seconds (s) or milliseconds (ms). Default unit are milliseconds.
Must be a positive integer. If
specified, jstat will produce its output at each
interval.

count

Number of samples to display. Default
value is infinity; that is, jstat displays statistics until
the target JVM terminates or the jstat command is terminated. Must be a positive integer.

The syntax of the vmid string largely
corresponds to the syntax of a URI:

[protocol:][//]lvmid[@hostname][:port][/servername]

OPTIONS:

-statOption

Determines
the statistics information that
jstat displays. The following table lists the
available options. Use the -options
general option to display the list of options for
a particular platform installation.

-hn

Display a
column header every n samples (output rows), where n is a positive integer. Default value is 0, which displays the
column header above
the first row of data.

-tn

Display a
timestamp column as the first column of output. The timestamp is the the time since
the start time of the target JVM.

-gc Option ( You will get
sample output at : Check Java Process
Performance and statistics in Linux )

-gccapacity Option

-gccause

-gcnew Option

-gcnewcapacity Option

-gcold Option

-gcoldcapacity Option

-gcpermcapacity Option

-gcutil

-printcompilation Option

Using the gcutil option

This example attaches to lvmid 21891 and
takes 7 samples at 250 millisecond intervals and displays the
output as specified by the -gcutil option.

jstat -gcutil 21891 250 7

S0 S1
E O P
YGC YGCT FGC
FGCT GCT

12.44 0.00
27.20 9.49 96.70
78 0.176 5
0.495 0.672

12.44 0.00
62.16 9.49 96.70
78 0.176 5
0.495 0.672

TimeStamp for each sample

This example attaches to lvmid 21891 and
takes 3 samples at 250 millisecond intervals. The -t option is used to generate
a time stamp for each sample in the

first column.

jstat -gcoldcapacity -t
21891 250 3

Timestamp OGCMN OGCMX OGC OC YGC
FGC FGCT GCT

150.1 1408.0 60544.0 11696.0 11696.0
194 80 2.874
3.799

150.4 1408.0 60544.0 13820.0 13820.0
194 81 2.938
3.863

150.7 1408.0 60544.0 13820.0 13820.0
194 81 2.938
3.863

The Timestamp column reports the elapsed
time in seconds since the start of the target JVM. In addition, the -gcoldcapacity output shows
the old generation capacity (OGC) and the old
space capacity (OC) increasing as the heap expands to meet allocation and/or
promotion demands. The old
generation capacity (OGC) has grown to from 11696 KB to 13820 KB after the 81st Full GC (FGC). The maximum
capacity of the generation (and space) is 60544 KB (OGCMX), so it still has room to expand.