To Obtain GC details from running java process whithout adding the GC monitoring parameters in jvm args

Just wanted to share a tool for GC Monitoring.

If you’ve forgotten to enable GC logging, or wanted to monitor GC in the middle of the load test, there is a good substitute to watch how GC operates over time.

jstat is the tool of choice. jstat can provide good visibility into GC for a live program. jstat provides nine options to print different information about the heap; jstat -options will provide the full list.
One useful option is -gcutil, which displays the time spent in GC as well as the percentage of each GC area that is currently filled. Other options to jstat will display the
GC sizes in terms of KB.

jstat takes an optional argument—the number of milliseconds to repeat the command—so it can monitor over time the effect of GC in an application.

Syntax : jstat -gcutil <pid> <Milli Sec to repeat>

Here is some sample output repeated every second:
Ø jstat -gcutil 90776 1000

      S0     S1     E        O         M     CCS    YGC  YGCT    FGC    FGCT     GCT
80.52   0.00  12.98  45.07  95.85  91.20   4808  296.955    42   18.608  315.563
80.52   0.00  12.98  45.07  95.85  91.20   4808  296.955    42   18.608  315.563
80.52   0.00  12.98  45.07  95.85  91.20   4808  296.955    42   18.608  315.563

When monitoring started, the program had already performed 4808 collections of the young generation (YGC), which took a total of 296.955 seconds (YGCT). It had also performed
42 full GCs (FGC) requiring 18.608 seconds (FGCT); hence the total time in GC (GCT) was 315.563 seconds.

Since the sample was taken after the no load test and since there is no active load, so the readings were same.


All three sections of the young generation are displayed here: the two survivor spaces (S0 and S1) and eden (E). Then old generation (O) and MetaSpace (M).

Comments

Popular posts from this blog

Steps to Analyze AWR Report in Oracle

Verifications and Error Handling in LoadRunner *Web_reg_find and Web_reg_save_param*

Examples on Date and Time in LoadRunner