Pages

jstat - Tool for JVM Statistics Monitoring

In this article we are going to elaborate the jstat command tool which
is a part of JAVA commands (comes with jdk package). This article is the
continuation of this previous article.

As we know the standard format of commands in java, the jstat command also have the format(in command prompt). jstat [ generalOption | outputOptions vmid [interval[s|ms] [count]] ]

In here,generalOption : Options commons for all commands, I will define in bottom.outputOptions : Output specific options consisting a single stateOption and any of -t/-h/-Jvmid : Virtual machine identifier, a string indicating the target JVM. I will explain in bottom. interval[s|ms] : Interval time seconds (s) / milliseconds (ms). jstat will produce its output at each interval.count : Number of samples to display.

jstat shows performance statistics for an JVM(Instrumented HotSpot). jstat use a identifier to get the JVM info.

-stateOption: Defines the statistics info of jstat . It has following options class : Statistics on the class loader. Details of shown columns are
Loaded : Number of loaded classes
Bytes : Number loaded memory in Kb.
Unloaded : Number of classes unloaded.
Bytes : Number of Kbytes unloaded.
Time : Time spent for class load and unload operations.

gccause : Summary of garbage collection statistics (same to -gcutil but including last and current GC events). Additional columns other than gcutil are
LGCC :Cause of last Garbage Collection.
GCC : Cause of current Garbage Collection.

gcutil : Summary of garbage collection(GC) statistics. Columns details are
S0 : Survivor space 0 utilization as a percentage of the space's current capacity.
S1 : Survivor space 1 utilization as a percentage of the space's current capacity.
E : Eden space utilization as a percentage of the space's current capacity.
O : Old space utilization as a percentage of the space's current capacity.
P : Permanent space utilization as a percentage of the space's current capacity.
YGC : Number of young generation GC events.
YGCT : Young generation garbage collection time.
FGC : Number of full GC events.
FGCT : Full garbage collection time.
GCT : Total garbage collection time.

So, now VMI, the virtual machine Identifier, in shortcut vmid. It's a simple way to specify a vm. The syntax of a vmid string is[protocol:][//]lvmid[@hostname][:port][/servername]protocol : Communication protocol.lvmid : The local virtual machine identifier for the target JVM.(kind of pid of a OS)hostname :A hostname or IP address.port :The default port for communicating with the remote server. For the default rmi protocol, the port indicates the port number for the rmiregistry on the remote host.servername : It depends on implementation. Like as ,
For the optimized local protocol, this field is ignored.
For the rmi protocol, it represents the name of the RMI remote object on the remote host.

Example :

I ran jconsole application to get its PID and monitor jconsole is
self for statistics. I use this command where my PID(of jconsole)= 7972,
interval time 250ms and 7 time recording. jstat -gcutil 7972 250 7