Monitoring Garbage Collection In Java
Garbage collection in java is a major gateway to monitor the health of a JVM. Here in this article we will discuss about jstat, a command line tool to monitor the garbage collection in java , which shows you a number of statistics regarding how the JVM is performing. The tools jps and jstat are included with both the HotSpot and JRockit JVMs.
Here we assume that you are using HotSpot, as JRockit does not have a permanent generation.
1. Use JPS to determine the process ID of your SOA Suite server.
2. Use the jstat command to view the sizes of the survivor spaces and eden:
jstat -gc -h10 <pid> 2000
The metrics we are interested in are YGCC, YGCT, FGCC, and FGCT. These are the young garbage collection count, young garbage collection time, full garbage collection count, and full garbage collection time.
jstat is a JVM tool that can be used to view a number of runtime statistics regarding the JVM. The option –gc prints statistics about garbage collection, including the capacity and utilization of each memory pool. In the preceding example, the parameter –h10 prints the headers every 10 lines, to make the output easier to read, and 2000 is the time in milliseconds between each sample (2 seconds).
Since garbage collection is a “stop the world” activity, any time spent garbage collecting is not the time spent in executing your business logic. We therefore want to minimize the amount of time spent in performing garbage collection.
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.