Thursday, 11 July 2013

Using jps and jstat to get JVM GC statistics



Using jps and jstat to get JVM GC statistics

Ensure that JDK bin directory is on your path
Issue command 'jps' to find the running JVM's PID ( it will show all running java processes ).
Once you have identifed the PID issue command 'jstat -gcutil [PID] 5000', replacing [PID] with the one identified above
Now  the console should update on a 5 second basis with statistics.
Fields available in jstat gcutil output

Basically, the first set of columns (S0, S1, E, O, P) describes the utilisation of the various memory heaps
(Survivor heaps, Eden - young generation, Old generation and Perm. heap space).

Next, (YGC and YGCT) show the number of young (eden) space collections and total time taken so far doing these collections.

Columns (FCG, FGCT) show the number and time taken doing old space collections.

Lastly, GCT shows the total time taken performing garbage collection so far.

Sample Output:
#Timestamp         S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT
#144415.1  0.00   0.00  10.66  21.60  51.84    567   79.287     2    1.276   80.563


OptionDisplays...
classStatistics on the behavior of the class loader.
compilerStatistics of the behavior of the HotSpot Just-in-Time compiler.
gcStatistics of the behavior of the garbage collected heap.
gccapacityStatistics of the capacities of the generations and their corresponding spaces.
gccauseSummary of garbage collection statistics (same as -gcutil), with the cause of the last and current (if applicable) garbage collection events.
gcnewStatistics of the behavior of the new generation.
gcnewcapacityStatistics of the sizes of the new generations and its corresponding spaces.
gcoldStatistics of the behavior of the old and permanent generations.
gcoldcapacityStatistics of the sizes of the old generation.
gcpermcapacityStatistics of the sizes of the permanent generation.
gcutilSummary of garbage collection statistics.
printcompilationHotSpot compilation method statistics.

No comments:

Post a Comment