YourKit プラグインを使用したプロファイリング
There is a plugin for Confluence 2.2 and later which allows easy profiling using the YourKit profiler. No license is required to generate a memory or CPU snapshot, but you will need at least an evaluation license to analyse the results.
On this page:
JVM で YourKit を構成する
Download YourKit 6.0 for your platform and follow the installation instructions to install it.
Note: YourKit version 7 is not compatible with the Confluence yourkit plugin.
次の説明は、Oracle (以前の Sun) JDK を使用した Confluence および Tomcat のインストールに適用されます。これらは、他のアプリケーション サーバーや JVM では簡単に適用することができます。詳細は YourKit ドキュメントを参照してください。
Windows の構成
Windows では、YourKit インストール ディレクトリの下の bin/win32/
ディレクトリの PATH 環境変数を追加します。たとえば、[コントロール パネル] > [システム] > [詳細] > [環境変数] 経由で、PATH に "C:\Program Files\YourKit Java Profiler 6.0.12\bin\win32" を追加することができます。
Confluence の JVM が YourKit エージェントを使用するように設定するには、Confluence のアプリケーション ディレクトリの bin/setenv.bat
ファイルの CATALINA_OPTS にパラメーターを追加する必要があります。このファイルは Tomcat の startup パラメーターを制御するため、変更後に再起動する必要があります。
末尾に、次のような 'agentlib' パラメーターを追加します。
set CATALINA_OPTS=%CATALINA_OPTS% -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -XX:+UseG1GC -agentlib:yjpagent
Linux/Mac OS X の設定
Unix ベースのシステムでは、次のように、ライブラリパス環境変数にインストール ディレクトリが含まれます。
- Mac の場合:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/path/to/yourKitAgent
- 他の Unix ベースのシステムの場合:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/yourKitAgent
一般に、JDK を設定するには、agentlib
パラメーターを追加します。
java -agentlib:yjpagent ...
これを、Tomcat の bin/setenv.sh
に追加できます。例:
CATALINA_OPTS="$CATALINA_OPTS -Djava.awt.headless=true" -agentlib:yjpagent "
パフォーマンスの影響
YourKit の実行はパフォーマンスに影響を与える可能性があります。
パフォーマンスの問題を最小限に抑えるため、agentlib パラメーターで次の変更を使用します。
-agentlib:yjpagent=disablecounts,disablealloc,disablej2ee
YourKit ドキュメントの「Profiling overhead: how to reduce or avoid」も参照してください。
YourKit プラグインのインストール
プラグインをダウンロードし、管理、プラグイン ページから Confluence にアップロードします。
新しいメニュー オプション「YourKit プロファイル」が「管理」見出しの下に表示されます。これをクリックスト、メモリまたは CPU スナップショットへ移動するオプションが表示されます。
このプロファイラー ダンプはローカルの一時ディレクトリに保存され、完了するとパスを示します。CPU スナップショットの場合は、30 秒以上かかります。メモリ スナップショットの場合は、10~15 秒かかります。
スクリーンショット: メモリまたは CPU スナップショットへ移動できます
この操作を行う理由
Analysing a profiler dump enables Atlassian Support (or you, if you are interested) to see exactly what is happening in your application: what classes are using the memory, what is using CPU and so on. This can help us debug tricky performance problems which would otherwise be impossible to analyse remotely.
次の場合に CPU スナップショットを作成します。
- Confluence が応答しない場合がある
- ページの読み込みに時間がかかる
- Confluence の CPU 使用率がピークに達しています。
次の場合にメモリ スナップショットを作成します。
- Confluence のメモリ使用量が予想より多い
- ログに OutOfMemoryError が表示される
If you run into situations where Confluence is unresponsive and you are not able to trigger a memory snapshot, please ensure that you start Confluence with the onexit=memory
parameter in the JVM options (as in the example below) and simply shut down Confluence. Before shutting down a memory snapshot will be created.
-agentlib:yjpagent=onexit=memory
Plugin Source Code
The source code for this Confluence plugin is available from Subversion and browseable in Fisheye. The JAR produced by 'mvn package' includes a copy of the YJP redistributable bundled in META-INF/lib/.