Object Instance Tracking for Java
This page describes how to configure and use object instance tracking for Java applications. For more information about why you may need to configure this, see Java Memory Thrash.
When object instance tracking is enabled, Splunk AppDynamics tracks the top 20 application classes in the heap by default. You can also track specific classes.
Prerequisites for Object Instance Tracking
- Review Java Supported Environments for information about platform support for object instance tracking.
- For JVMs prior to Java 9, object instance tracking uses
tools.jar
. If your application runs with the JDK,tools.jar
should be already available. If you are running with the JRE, you must addtools.jar
to <JRE_HOME>/lib/ext
and restart the JVM. You can findtools.jar
in <JAVA_HOME
>/lib/tools.jar
. - In some cases, you might also need to copy
libattach.so
(Linux) orattach.dll
(Windows) from your JDK to your JRE. - Depending on the JDK version, you may also need to specify the classpath as shown below (along with other
-jar
options). - For Java 9 or later, JEP220 moved the capabilities needed by OIT to the Core Java runtime, therefore
tools.jar
is no longer necessary. If your application runs with JDK9+, jdk.jcmd is already available. If you are running with the JRE, you must add jdk.jcmd to <JRE_HOME>/bin and <JRE_HOME>/lib using jlink.
Specify the Classpath
-classpath
option for the application. For example:- On Windows:
java -classpath <complete-path-to-tools.jar>;%CLASSPATH% -jar myApp.jar
- On Unix:
java -Xbootclasspath/a:<complete-path-to-tools.jar> -jar myApp.jar
Enable Object Instance Tracking
- In the left navigation pane, click Tiers & Nodes.
- In the right pane, expand the tier node and open the Node Dashboard for the node on which you want to enable object instance tracking.
- Click the Memory tab.
- Click the Object Instance Tracking subtab.
- Click ON.
Track Specific Classes
Use the Configure Custom Classes to Track option on the Object Instance Tracking subtab to specify instances of specific classes to track. Note that the classes you configure here are tracked only if their instance count is among the top 1000 instance counts in the JVM.
To track instances of custom classes:
- On the Object Instance Tracking tab, click Configure Custom Classes to Track.
- On the Instrumentation page that displays, click the tier you want to customize.
- In the Object Instance Tracking section for the tier, click Add.
- Enter the fully-qualified class name of the class to track and click Save.