jprofiler分析java应用程序性能
1、测试环境
3、将jprofiler_linux_6_2_2.sh上传到服务器,假设上传到/opt/jprofiler
9、.当中断JProfiler连接时
1、测试环境
CentOS 5.5 final(64bit) + tomcat6.20 + OpenJDK1.6.242、Wndows客户端安装 略
jprofiler_linux_6_2_2.sh
jprofiler_windows_6_2_2.exe
3、将jprofiler_linux_6_2_2.sh上传到服务器,假设上传到/opt/jprofiler
cd /opt/jprofiler4、客户端连接配置
chmod +x *.sh
./jprofiler_linux_6_2_2.sh -c
按照提示来安装,提示都很简单,不在多说。安装路径选择 /opt/jprofiler6
注意,这里的 -c 意思是用字符方式来安装,如果机器上没有 X 则加上该参数.
运行 JProfiler 。第一次打开会有向导,忽略它。5、服务器端配置
选择 Session->Integration Wizard->New Remote Integratation
选择 on a remote computer Linux x86/AMD 64;next
选择 JVM Vendor:sun Vsersion:1.6.0 Model:hotspot; 64 bit JVM 前打上够;next
选择 wait for a connection from the jprofiler GUI;next
输入remote address:10.0.0.19;next
输入Remote installation directory:/opt/jprofiler6;next
输入JProfiler port:默认8849
这里会列出需要在服务器端做的配置:
Integration type: [Generic application]
Selected JVM: Sun 1.6.0 (hotspot)
Startup mode: Wait for a connection from the JProfiler GUI
(1) Please insert
-agentpath:/opt/jprofiler/bin/linux-x64/libjprofilerti.so=port=8849
into the start command of your remote application right after the java command.
A remote session named Remote application on 10.0.0.147 will be created that connects to a running instance of the remote application that is started with the modified start command.
修改系统环境配置文件 /etc/profile ,增加
JPROFILER_HOME =/ opt / jprofiler4 / bin / linux - x86
exportLD_LIBRARY_PATH = $LD_LIBRARY_PATH:$JPROFILER_HOME
修改TOMCAT启动文件catalina.sh,添加-agentpath:/opt/jprofiler/bin/linux-x64/libjprofilerti.so=port=8849 内容到CATALINA_OPTS中;
“-agentpath:/opt/jprofiler/bin/linux-x64/libjprofilerti.so=port=8849 ” 此内容由客户端软件生成CATALINA_OPTS = " $CATALINA_OPTS-Xms128m-Xmx128m$JPDA_OPTS-agentpath:/opt/jprofiler/bin/linux-x64/libjprofilerti.so=port=8849 "
7、Reboot Linux and startup Tomcat using startup.sh;
The log of tomcat which is $CATALINA_HOME/logs/catalina.out will show:8、启动客户端
JProfiler > Protocolversion 23
JProfiler > UsingJVMTI
JProfiler > 64 - bitlibrary
JProfiler > Listeningonport: 8849 .
JProfiler > Nativelibraryinitialized
JProfiler > Waiting for aconnectionfromtheJProfilerGUI
点击jprofiler菜单 session>start center>Open Session
Available session configurations中列出了刚才配置的连接,选中使用就OK了!!
9、.当中断JProfiler连接时
The log of tomcat which is $CATALINA_HOME/logs/catalina.out will show:JProfiler > Disconnected.Waiting for reconnection.
JProfiler > Listeningonport: 8849 .