且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jprofiler工具安装及使用

更新时间:2022-09-30 20:46:34

1、  下载相应版本

      下载链接地址:http://www.ej-technologies.com/download/jprofiler/files.html

      根据本身系统的类型下载相应的版本,这里主要以windows64位系统及linux系统上的版本为例。


2、  安装

      1)、客户端安装:安装好工具,启动会要求注册

             下面是注册码,任意选择一个:

                 L-Larry_Lau@163.com#24777-1i8da63tvtyl2#1119
                 L-Larry_Lau@163.com#61624-1dvrt8wj18v1#6260
                 L-Larry_Lau@163.com#50028-se4zkrr1m6t1#10246
                 L-Larry_Lau@163.com#15600-189y158nwwvuk#339
                 L-Larry_Lau@163.com#30640-1lklqdbcjmhxs#4016
                 L-Larry_Lau@163.com#57474-53b2wr1311gnz#10228
                 L-Larry_Lau@163.com#19667-11r2awc10nqelb#4016
                 L-Larry_Lau@163.com#60353-pphob7wraf0y#515
                 L-Larry_Lau@163.com#65157-1ae6ytp7ygj8m#0012
                 L-Larry_Lau@163.com#16226-1n5h5951019s7s#7343

                 注册码前面的邮箱部分为注册邮箱

       2)、服务器安装

      我这里下载的是tar.gz版本, 可以先下载在上传到服务器也可以直接在服务器上下载:

      命令:wget http://download.ej-technologies.com/jprofiler/jprofiler_linux_7_1_2.tar.gz

      解压:tar -xzvf jprofiler_linux_7_1_2.tar.gz

      拷贝:cp –rf jprofiler7 /usr/local/   (拷贝到安装目录)


      配置环境变量:

           修改/etc/profile系统配置文件:

           JPROFILER_HOME=/usr/local/jprofiler7/bin/linux-x64

           export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JPROFILER_HOME

           使配置文件生效:source /ect/profile


3、  Jprofile 与resin4.0服务器启动配置

      1)  找到resin.xml文件,在<cluster>…</cluster>其中加入如下配置:

      <class-loader>

              <tree-loader path="/usr/local/jprofiler7/lib"/>

              <tree-loader path="/usr/local/jprofiler7/bin"/>

      </class-loader>

 

      <server-default>

           <jvm-arg>-agentpath:/usr/local/jprofiler7/bin/linux-x64/libjprofilerti.so=port=8849,nowait</jvm-arg>

      </server-default>

 

      也可以将jvm参数配置放到resin.properties 文件中的jvm参数配置中

 

2)  启动resin服务器

      查看jvm-channel-service.log日志如果输出如下,证明启动成功

      JProfiler> Protocol version 35

      JProfiler> Using JVMTI

      JProfiler> JVMTI version 1.1 detected.

      JProfiler> 64-bit library

      JProfiler> Listening on port: 8849.

      JProfiler> Instrumenting native methods.

      JProfiler> Can retransform classes.

      JProfiler> Can retransform any class.

      JProfiler> Native library initialized

      JProfiler> VM initialized

      JProfiler> Waiting for a connection from the JProfiler GUI ...

      JProfiler> Using dynamic instrumentation

      JProfiler> Time measurement: elapsed time

      JProfiler> CPU profiling enabled

      JProfiler> Hotspot compiler enabled

                  …

      其他类型的服务器启动配置,有兴趣的同学到网上搜搜,一般只需要在服务器的jvm启动参数中加入:-agentpath:/usr/local/jprofiler7/bin/linux-x64/libjprofilerti.so=port=8849,nowait该参数就可以。

 

4、  客户端jprofile监控使用

      在本地启动安装好的jprofile,如果未破解的请按照第二步来做,启动好后New Session

      Jprofiler工具安装及使用

      Ok 后如下:

      Jprofiler工具安装及使用

      一般选择所有项。

      Jprofiler工具安装及使用

      复选框勾选,一般选择第二项, 保存上次回话的数据,方便下次数据变更比较。

      选择ok

      到此一个简单的监控会话产生了,具体的界面监控画面分析使用请网上搜索 JProfiler使用说明.pdf  该文档不是7版本的使用文档, 不过大同小异

      最后说明一点, 该工主要是监控内存占用情况看是否有 member leak ,cpu的使用百分比, 但实际会影响应用的处理性能,且数据不会是服务器上的实时监控的数据。

本文转自银狐博客51CTO博客,原文链接http://blog.51cto.com/foxhound/1783536如需转载请自行联系原作者

战狐