jvmstat の変更点
JavaVMのパフォーマンス情報をリアルタイムにモニタリングするツール。
-[[オフィシャル>http://developers.sun.com/dev/coolstuff/jvmstat/]]
-[[Devel/Java/jvmstat/MRTGと組み合わせる]]
~
|jvmstat |A tool to sample and log instrumentation|
|jvmps |A tool providing a simple Java process listing|
|visualgc |A tool to graphically display instrumentation|
|perfagent|A server providing remote access to instrumentation|
|jvmsnap |A tool to snapshot instrumentation and output as name/value pairs|
~
以下
|~モニタリングするホストのIP|192.168.0.2|
と仮定。~
*インストール
**Linux
unzip jvmstat-2.0_b11.zip
mv jvmstat /usr/local/
vi ~/.bash_profile
>
PATH に /usr/local/jvmstat/bin を追加し、
<
source ~/.bash_profile
cd /usr/local/jvmstat/policies/
configurepolicy PerfAgentAll.tmpl PerfAgentAll.policy
configurepolicy PerfAgentMinimal.tmpl PerfAgentMinimal.policy
configurepolicy PerfAgentTrustedHost.tmpl PerfAgentTrustedHost.policy
cp PerfAgentMinimal.policy PerfAgent.policy
**Windows
c:\に解凍。~
システムのプロパティ>詳細>環境変数 でPATHに c:\jvmstat\bat を追加。
cd c:\jvmstat\policies
configurepolicy PerfAgentAll.tmpl PerfAgentAll.policy
configurepolicy PerfAgentMinimal.tmpl PerfAgentMinimal.policy
configurepolicy PerfAgentTrustedHost.tmpl PerfAgentTrustedHost.policy
copy PerfAgentMinimal.policy PerfAgent.policy
*テスト
**jvmps
jvmps
結果
9398 jvmps.jar
9383 foobar
**jvmstat
jvmstat -gcutil 9383
結果
S0 S1 E O P YGC YGCT FGC FGCT GCT
4.71 0.00 58.53 24.25 67.16 8 0.118 3 0.338 0.455
**visualgc
#ref(visualgc.png,right,around,20%)
visualgc 9383
#clear
**perfagent
192.168.0.2で
perfagent
とすると、他のホストから以下のようにしてリモートアクセスできるようになる。
jvmps 192.168.0.2
jvmstat -gcutil 9383@192.168.0.2
visualgc 9383@192.168.0.2
*備考
**J2SE 5.0でjvmstatの一部は名前を変えてJDKに取り込まれた
|前|後|h
|jvmstat|jstat|
|jvmps|jps|
|perfagent|jstatd|
**パフォーマンス情報が保存されるファイル
パフォーマンス情報は~
/tmp/hsperfdata_'''実行ユーザー名'''/'''プロセス番号'''~
というファイルにバイナリ形式で記録される模様。
**perfagent経由で取得できない場合
こんなエラーが出てしまう場合
Error communicating with remote agent Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect
/etc/hostsの設定を確認する。~
誤
127.0.0.1 hoge localhost.localdomain localhost
正
127.0.0.1 localhost.localdomain localhost
192.168.0.2 hoge hoge.my.domain
*ポート
perfagent~
TCP 1099
*参考
-jvmstat
--[[jvmstat (Sun Hostspot VM Performance Monitoring Tool)>http://www.nminoru.jp/~nminoru/java/jvmstat/]]
--[[Javaデバッグツール>http://www.okisoft.co.jp/esc/debugtool/]]
-ガベージコレクトの仕組み
--[[Mathematical Infomation Technology>http://www.mit.msn.to/option/garbagecollect.html]]
--[[@IT:チューニングのためのJava VM講座(後編)>http://www.atmarkit.co.jp/fjava/rensai3/javavm02/javavm02_1.html]]
--[[Java memo>http://homepage3.nifty.com/satoshis/java/memo.html]]
-[[日本Sambaユーザ会 - Sambaが動作しないときの診断方法>http://www.samba.gr.jp/doc/diag.html]] /etc/hostsの正誤
-その他のビジュアライザ
--[[gcPortal>http://www.okisoft.co.jp/esc/debugtool/#gcPortal]]
--[[Samurai>http://yusuke.homeip.net/samurai/]]
--[[GCViewer>http://www.tagtraum.com/gcviewer.html]]
*Amazon
#amazon(4894714361,left)