Jprofiler工具安裝及使用

1、  下載相應版本

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

      根據本身系統的類型下載相應的版本,這裏主要以windows64位系統及linux系統上的9.2版本爲例。


2、  安裝

      1)、客戶端安裝:安裝好工具,啓動會要求註冊

             下面是註冊碼,任意選擇一個(適用於9.2版本):

                              [email protected]#23874-hrwpdp1sh1wrn#0620 
                             [email protected]#36573-fdkscp15axjj6#25257 
                             [email protected]#5481-ucjn4a16rvd98#6038 
                             [email protected]#99016-hli5ay1ylizjj#27215 
                             [email protected]#40775-3wle0g1uin5c1#0674

         註冊碼前面的郵箱部分爲註冊郵箱(用戶名公司名什麼的隨便填就行了,只有註冊碼需要整條拷貝上面任一個使用)

       2)、服務器安裝

      我這裏下載的是tar.gz版本, 可以先下載在上傳到服務器也可以直接在服務器上下載:

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

      解壓:tar -xzvf jprofiler_linux_9_2.tar.gz

      拷貝:cp -rf jprofiler9 /usr/local/   (拷貝到安裝目錄)

      配置環境變量:

           修改/etc/profile系統配置文件,添加如下內容(或者是將下面內容寫入/etc/profile.d/jprofiler.sh新文件):

           JPROFILER_HOME=/usr/local/jprofiler9/bin/linux-x64
           export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JPROFILER_HOME

           使配置文件生效:source /ect/profile   (或執行source /etc/profile.d/jprofiler.sh)


3、  Jprofile 與resin4.0服務器(這是一個類似於tomcat的服務中間件,這裏只是演示該服務如何配置jprofiler,其他類型服務需要自行探索)啓動配置

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

      <class-loader>

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

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

      </class-loader>

 

      <server-default>

           <jvm-arg>-agentpath:/usr/local/jprofiler9/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/jprofiler9/bin/linux-x64/libjprofilerti.so=port=8849,nowait該參數就可以。例如,對於tomcat,在tomcat/bin目錄下修改

vi catalina.sh
# OS specific support.  $var _must_ be set to either true or false 一行下添加如下(主要是最後一行“-agentpath:/usr/local/jprofiler9/bin/linux-x86/libjprofilerti.so=port=8849,nowait”,注意區分版本爲x86還是x64,端口號可以變,在客戶端上使用對應端口即可,前面幾行我是爲了讓jconsole也能連接jvm做的配置):

CATALINA_OPTS="-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=192.168.160.129
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false  
-Dcom.sun.management.jmxremote.authenticate=false
-agentpath:/usr/local/jprofiler9/bin/linux-x64/libjprofilerti.so=port=8849,nowait"

 

4、  客戶端jprofile監控使用

      在本地啓動安裝好的jprofile,如果未破解的請按照第二步來做,啓動好後New Session

      

      Ok 後如下:

      

      一般選擇所有項。

      

      複選框勾選,一般選擇第二項, 保存上次回話的數據,方便下次數據變更比較。

      選擇ok

      到此一個簡單的監控會話產生了,具體的界面監控畫面分析使用請網上搜索 JProfiler使用說明.pdf  該文檔不是7版本的使用文檔, 不過大同小異

      最後說明一點, 該工主要是監控內存佔用情況看是否有 member leak ,cpu的使用百分比, 但實際會影響應用的處理性能,且數據不會是服務器上的實時監控的數據。


客戶端JProfiler安裝及配置

待截圖補充。

發佈了40 篇原創文章 · 獲贊 121 · 訪問量 142萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章