Javaのオブジェクトインスタンスの追跡
このページでは、Java アプリケーションのオブジェクトインスタンス追跡を構成して使用する方法について説明します。これを構成する必要がある理由の詳細については、「Java メモリスラッシング」を参照してください。
オブジェクトインスタンス追跡が有効な場合、Splunk AppDynamics ではデフォルトでヒープの上位 20 のアプリケーションと上位 20 のシステム(コア Java)クラスが追跡されます。特定のクラスを追跡することもできます。
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.jarshould be already available. If you are running with the JRE, you must addtools.jarto <JRE_HOME>/lib/extand restart the JVM. You can findtools.jarin <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
-jaroptions). - For Java 9 or later, JEP220 moved the capabilities needed by OIT to the Core Java runtime, therefore
tools.jaris 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.
クラスパスの指定
-classpath オプションを使用してクラスパスを設定します。例:- Windows:
java -classpath <complete-path-to-tools.jar>;%CLASSPATH% -jar myApp.jar - Unix:
java -Xbootclasspath/a:<complete-path-to-tools.jar> -jar myApp.jar
オブジェクトインスタンス追跡の有効化
- 左側のナビゲーションウィンドウで、Tiers & Nodes をクリックします。
- 右のペインで、ティアノードを展開し、オブジェクトインスタンス追跡を有効にするノードのノードダッシュボードを開く。
- [Memory] タブをクリックします。
- [Object Instance Tracking] サブタブをクリック。
- [ON] をクリックします。
特定のクラスの追跡
追跡対象として特定のクラスのインスタンスを指定する場合は、[Object Instance Tracking] サブタブの [Configure Custom Classes to Track] オプションを使用します。なお、ここで構成したクラスが追跡されるのは、インスタンスカウントが JVM の上位 1000 のインスタンスカウント内にある場合のみです。
カスタムクラスのインスタンスを追跡するには:
- [Object Instance Tracking] タブで、[Configure Custom Classes to Track] をクリックします。
- 表示される [Instrumentation] ページで、カスタマイズするティアをクリック。
- ティアの [Object Instance Tracking] セクションで、[Add] をクリック。
- 追跡するクラスの完全修飾クラス名を入力し、[Save] をクリック。