jstat is a simple utility tool, that is present in JDK to provide JVM performance-related statistics like garbage collection, compilation activities. The major strength of jstat is its ability to capture these metrics dynamically when JVM is running without any pre-requisite instrumentation. What do we mean by it? Say for example if you want to capture garbage collection related statistics, you need to pass below arguments before you start the JVM:


This argument will enable GC logs and print them in the specified file path. Say suppose you havenít passed this argument, then GC related statistics will not be generated. This is where jstat can come handy. Dynamically you can connect to JVM and capture GC, compilation related statistics as shown below.

[b]How to launch jstat?[b]
Execute below command. Itís a simple option to launch jstat.

 jstat -gc -t 11656 10000 30

[b]-gc[b]: garbage collection related statistics will be printed

-t timestamp since JVM was started will be printed

11656: target JVM process Id

10000: statistics will be printed every 10,000 milliseconds (i.e. 10 seconds).

30: statistics will be printed for 30 iterations. Thus, the above option will cause the JVM to print metrics for 300 seconds (i.e. 10 seconds x 30 iterations).

Data generated by jstat
When you launch jstat with above options, here is the output that will be generated:

Read More here: "https://blog.gceasy.io/2019/11/18/jstat-analysis/"