Enable Log-based Garbage Collection
For applications running in JVMs < 1.7, Garbage Collection monitoring is based on periodically parsing certain Garbage Collection logs.
To set up Garbage Collection logging for your application, use these arguments:
-Xloggc:log-file-path
-XX:+Usecollector-type
-XX:+PrintGCDetails
The log-file-path -XX:+Use
Collector Type | Effect |
---|---|
CMS Collector -XX:+UseConcMarkSweepGC
|
Good for applications that require low pause times and that can share resources with the garbage collector. Use the |
Throughput or Parallel Collector
|
Can use multiple CPUs to speed up application throughput; good to use for work-intensive apps that can accept long pauses. |
G1 Collector
|
Available in Java 7 and designed to be a long term replacement for the CMS collector. This is a parallel, concurrent, and incrementally compacting low-pause collector. |
To direct the Controller to display logged information, register the following node properties in the Controller UI:
enable-jmx-visibility=true
enable-log-based-gc=visiblity=true
To change the default log check interval, register the following node property:
logbased-visibility-log-check-interval-in-mills=1000
Specify Regular Expressions for Parsing Garbage Collection Logs
When you enable log-based Garbage Collection metrics, the agent uses built-in regular expressions to accommodate different JDK and Garbage Collection type combinations. If the built-in regular expressions don't return the Garbage Collection metrics for your system, you can register the following node properties to specify custom regular expressions for parsing the logs:
-
young-gc-custom-regex-1
-
young-gc-custom-regex-2
-
young-gc-custom-regex-3
-
full-gc-custom-regex-1
-
full-gc-custom-regex-2
-
full-gc-custom-regex-3
After you set a custom regular expression using a node property, the agent no longer uses any of the built-in regular expressions to parse the logs.