java自带的性能监控与调优工具之 jstat

来源:互联网 发布:生产流程跟踪软件 编辑:程序博客网 时间:2024/06/05 04:47

 Jstat是Sun JDK中自带的监控工具,利用了JVM内建的指令对Java应用程序的资源和性能进行实时的命令行的监控,包括了对Heap size和垃圾回收状况的监控等等。JStat是命令行方式运行,对系统资源占用很小,在大压力下很少影响性能。并且运行要求低,只要通过Telnet或SSH等方式远程登录到服务器所在机器,就可以进行监控。在与Jmap、JStack等工具结合使用时非常方便。

 

使用jstat命令监测如下内存使用和垃圾回收统计数据:
  $ <JDK>/bin/jstat –gcutil  [-h<lines>] <pid> <interval>
jstat - gcutil选项打印所运行应用程序进程ID <pid>在指定抽样间隔<interval>下,堆使用及垃圾回收时间摘要,并且每<lines>行显示一次头信息。这产生出以下样例输出:
  S0     S1     E      O      P     YGC   YGCT    FGC    FGCT     GCT
  0.00   0.00  24.48  46.60  90.24  142   0.530   104   28.739   29.269
  0.00   0.00   2.38  51.08  90.24  144   0.536   106   29.280   29.816
  0.00   0.00  36.52  51.08  90.24  144   0.536   106   29.280   29.816
  0.00  26.62  36.12  51.12  90.24  145   0.538   107   29.552   30.090
名列含义:

S0:Survivor space 0 utilization as a percentage of the space's current capacity.
S1:Survivor space 1 utilization as a percentage of the space's current capacity.
E:Eden space utilization as a percentage of the space's current capacity.
O:Old space utilization as a percentage of the space's current capacity.
P:Permanent space utilization as a percentage of the space's current capacity.
YGC:Number of young generation GC events.
YGCT:Young generation garbage collection time.
FGC:Number of full GC events.
FGCT:Full garbage collection time.
GCT:Total garbage collection time.

参考资料:http://java.sun.com/javase/6/docs/technotes/tools/share/jstat.html

 

转自 :http://ruijunsuo.blog.163.com/blog/static/4005963220100597723/