Jprofiler工具安裝及使用
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
Ok 后如下:
一般選擇所有項。
復選框勾選,一般選擇第二項, 保存上次回話的數據,方便下次數據變更比較。
選擇ok
到此一個簡單的監控會話產生了,具體的界面監控畫面分析使用請查看附件JProfiler使用說明.pdf 該文檔不是7版本的使用文檔, 不過大同小異。
最后說明一點, 該工主要是監控內存占用情況看是否有 member leak ,cpu的使用百分比, 但實際會影響應用的處理性能,且數據不會是服務器上的實時監控的數據。