使用JProfiler排查遠程應用性能問題

在很多情況下,我們需要使用windows上的Jprofiler客戶端來檢測linux服務器上web程序的性能,以下是安裝與配置步驟。

一、安裝與配置

1.Jprofiler下載

本文使用9.2版本。
Windows下下載地址 http://www.ej-technologies.com/
linux下下載: curl -O http://download-keycdn.ej-technologies.com/jprofiler/jprofiler_linux_9_2.sh

2.服務器端安裝:

#本例中使用work用戶
sudo su work
export JAVA_HOME=/data/work/soft/jdk1.7.0_51/
export INSTALL4J_JAVA_HOME=$JAVA_HOME
chown work jprofiler_linux_9_2.sh
chmod +x *.sh
./jprofiler_linux_9_2.sh -c
這裏的 -c 意思是用字符方式來安裝。根據提示來安裝即可。安裝路徑建議設置在: /opt/jprofiler9,如果用默認安裝,會安裝在~/jprofiler9目錄下

3.配置JProfiler生成腳本

在本機配置JProfiler生成startup_jprofiler.sh腳本,生成方式如下:
在windows中運行JProfiler,進入Session菜單,依次選擇Integration Wizards–>New Server Integration,選擇”Profile an application server, locally or 77 remotely”
1.選擇tomcat 7
2.選擇 “On a remote computer” , Linux X86/AMD64
3.選擇Oracle –>1.7 –>hotspots
4.選擇” Start Immediately, Connect later with the JProfiler GUI”
5.在選擇機器上查看ip, ifconfig, 填入ip
6.遠程服務器JProfiler的安裝路徑,默認在/opt/jprofiler9: 默認在~/jprofiler9
7.tomcat的startup.sh腳本,從遠程服務器上把tomcat的bin目錄下的startup.sh複製到本地,再選擇本地的路徑:
8.選擇默認端口 8849
9. I will start the session later.
Finish後,會在Start Center顯示剛創建的Session

4.上傳腳本:

把生成的startup_jprofiler.sh(在選擇的startup.sh目錄中)文件上傳到遠程tomcat的bin目錄下
chmod +x startup_jprofiler.sh(腳本賦寫權限)

5.啓動腳本:

./startup_jprofiler.sh,然後就可以在windows本地遠程訪問linux服務器上的jprofiler了

6.啓動Session

初始化profiling設置,這裏選擇所有功能。

二、開啓並Attach Session

進入Start Center(工具欄中第一個按鈕),選擇已配置好的Session配置,點擊Start即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章