使用Jprofiler远程监控Tongweb
首先在window环境和linux环境下安装相同版本的Jprofiler,建议使用Jprofiler7.2.3版本,JDK版本1.6即可,实测可用。使用高版本Jprofiler8.1.4的时候出现报错,而且在Linux环境中需要使用JDK1.7或者jdk1.8。
linux端Jprofiler配置:
以安装的jprofiler7为例,8.0版本修改方法也一样
第一步:
打开Tongweb\bin目录下的startserver.sh文件
第二步:
在JVM参数配置部分添加如下代码JAVA_OPTS=-agentpath:/opt/jprofiler7/bin/linux-x86/libjprofilerti.so=port=8849,nowait
其中/opt/jprofiler7/bin是安装jprofiler的目录。
另外:在etc\profile中进行Jprofiler环境配置:代码如下:
export JPROFILER_HOME=/opt/jprofiler7/bin/linux-x86
第三步:启动Tongweb,此时会显示如下界面:
Windows下进行远程监控:
第一步:打开 菜单Session->Integeration Widzards ->new Server Integeration
第二步:选择 Generic Application Server->On a remote computer
第三步:JVM选择建议选择Oracle,根据实际情况选择Version和Mode。Mode选择使用的是interpreted。
第四步:选择wait for a connection from the Jprofiler GUI,点击next
第五步:Remote地址填写要连接的Linux下的IP:比如192.168.51.132
第六步:填写Linux下jprofiler的安装目录:如图所示
第七步:端口使用jprofiler默认的8849
后面的步骤点到Finish即可。
下面就可以使用Jprofiler监控了
一、使用客户端和服务器的Jprofiler版本必须一致,否则在Windows下启动Jprofiler时会提示版本不一致,无法使监控继续。
二、保持网络通畅,使用service iptables stop(关闭linux防火墙)
三、不使用Jprofiler压测过程不存在报错情况,但是在Jprofiler监控Tongweb时,在压测过程中出现Jprofiler崩溃和Tongweb崩溃的情况,此时出现报错信息为the network connection was lost the JVM....
在Jprofiler下的提示信息包括如下两条:
①reduce xmx的值 (可以尝试在startserver.sh中修改XMX的值,比如调为1024等...
)
②change your profiling setting (instrutment to sample)在Jprofiler监控开启时可以进行设置
四、启动Tongweb的时候有部分参数警告提示,但是不影响监控。
五、部分情况出现错误提示时,可能由于zlip依赖没有安装好,还有将opt/bin/linux-ppc下的libexpat.so.1放到usr\lib目录下
在X86环境下使用出现不能正常使用的情况,可以通过Xmanger远程连接也可以进行显示