GC Time Using jstat

 

GARBAGE COLLECTION TIME – (using JSTAT)

 

GCtime

  • Login to your Linux/Unix Server
  • Enter the below command to get the JAVA PID running on the server.

                          ps –ef|grep –i java

From the output take the application JAVA PID.

  • Using jstat command with gcutil option to find out the JVM Heap Memory Usage.

                 <JAVA_HOME>/bin/jstat –gcutil <JAVA PID> 1000 7

GC TIme cal

Above command  using 1000 and 7 at last is to take 7 samples at 1000 millisecond intervals.

From the  output we are able to see 1 GC happened from 326 to 327 at YGC(Young Garbage Collection) column. For calculating the Garbage Collection Time we can take the difference of YGCT(Young Garbage Collection Time). 

YGC(After GC) YGC(BEFORE GC) = (Count of number of GC Happened)

            [No of GC Happened]      327 – 326 = 1 [1 GC]

YGCT(After GC) YGCT(BEFORE GC) = (GC Time Taken for the GC)

  [GC Time Difference Calculation]      9.471 – 9.443 = 0.028 Sec [0.028 Sec taken for 1 GC]

So 1 Garbage collection was performed for Young Generation which took 0.028 sec.

Other way to calculate using Verbose GC logs for particular JVM {If it is enabled.}

Detailed Explanation on How to get GC Time using Verbose GC log: Click here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s