搭建环境 TPTP 远程服务的性能分析
前言,
项目需要改善性能问题。需要调查出性能差的模块。我用Eclipse的TPTP搭建了检测环境。留个笔记。
参考下面的文章很好,可以先看看。
一,软件版本。
WinXP SP2
Java 6
Tomcat 6
TPTP 4.7.1
Eclipse 3.5
#注意,Java版本,TPTP版本如果不同,配置方法有细微差别。
二,被检测机器的配置。
1,下载 Agent Controller
从 http://www.eclipse.org/tptp/home/downloads/ 可以下载。
我用的是 agntctrl.win_ia32-TPTP-4.7.2.zip。
2,展开到被检测机。我用的是 D:\TPTP
3,运行 SetConfig.bat 进行 TPTP 的环境配置。注意 Network access mode 要选择 ALL
4,运行命令安装 Windows 服务并运行。
manageservice add TPTP D:\TPTP
net start TPTP
5,用 SampleClient.exe 确认 Agent Controller 被正确运行。
6,在 PATH 中加入 D:\TPTP\plugins\org.eclipse.tptp.javaprofiler
为什么要加入这个路径呢?因为这个路径下有个 JPIBootLoader.dll 和 JPIAgent.dll 文件。
7,在 JavaVM运行参数中加入下面的参数。(我用的是 Tomcat6。 修改了catalina.bat 中的 JAVA_OPTS)
-agentlib:JPIBootLoader=JPIAgent:server=enabled;CGProf
8,启动被检测 Java 服务。
三,检测机的设置。
1,安装 TPTP Plugin
Eclipse 菜单 Help > Install New Software ...
从 Galileo - http://download.eclipse.org/releases/galileo 中选择 TPTP Plugin安装就行啦。
如果安装成功会有 Run > Profile 菜单。
2,在 Run > Profile Configurations ... 中添加被检测对象。
Host 中加入被检测机器。 用 Test Connection 检测是否和被检测机的 Agent Controller 连接上。
Agents 中找出被检测 JavaVM。