在做项目过程中,发现性能存在很大问题,想到了TPTP。

tptp官网:http://www.eclipse.org/tptp

=================下载,安装======================

++++++++++++++++++++++++++++++++++++++++++++++++

注意tptp的版本及eclipse的版本,JDK的版本,官网及介绍文档中均有提到

++++++++++++++++++++++++++++++++++++++++++++++++

TPTP All-in-One

建议下载这个,但是我是分别安装plugin及agentControl,所以重点讲独立安装。

TPTP Plugins for Eclipse

这个是eclipse的插件,下载完后,将包里的features和plugin中的文件分别放到你的eclipse中,然后重启就装好了

具体安装过程网上有很多,虽然tptp版本很多但是这个基本没有变化

这个插件装好以后,运行一般J2SE的项目已经没有任何问题,可以记录线程,运行时间,内存等。

Agent Controller

如果只装了tptp插件,你会发现没有办法对tomcat等服务器进行监控

当你尝试想profile时,会弹出一个dialog,让你选择monitor,但可惜是没有任何monitor!

写道
TPTP运行有两种模式, 一种是在TPTP的workbench里,一种是通过JVMPI(类似JVMDI, 远程调试的模式), 第一种需要你的项目导入到TPTP里, 第二种模式,你就可以很随意的在命令行运行你的程序,通过JVMPI(或者JVMTI)将你的JVM attach 到TPTP, 来进行调试

我其实无法准确解释AgentControl,大家可以去看文档,下载后文件夹中有一个html,介绍了具体使用,非常详细,接下去我就我的使用做个记录(相当于翻译吧)

================Agent Controller安装,配置=======================

1 从官网上下载,是个压缩包,也就是无需安装

2 设置环境路径

Set TPTP_AC_HOME=<<Agent Controller Home>> Set JAVA_PROFILER_HOME=%TPTP_AC_HOME%\plugins\org.eclipse.tptp.javaprofiler Set PATH=%JAVA_PROFILER_HOME%;%TPTP_AC_HOME%\bin;%PATH%

教程上有提到在tptp4.6以上可以简单配置,但是建议这样配置,避免麻烦。
我的路径:
*JAVA_PROFILER_HOME:%TPTP_AC_HOME%plugins\org.eclipse.tptp.javaprofiler
*TPTP_AC_HOME:C:\test\agentTPTP\(我的安装路径,接下去都以这个问安装目录)
*Path:...;%JAVA_PROFILER_HOME%;%TPTP_AC_HOME%\bin;
3 运行ACServer.exe
*在C:\test\agentTPTP\bin下
*注意在教程上提到过windows vista 7下可能存在权限问题,最好就是右击,run as admin,如果出现一个cmd
窗口,什么都没有但没有消失那就是说明成功了,如果出现诸如
[java] Error occurred during initialization of VM
[java] Could not find agent library on the library path or in the local dir 
ectory: JPIBootLoader
那就是路径配置错误,一闪消失,应该是权限的问题
教程上有提到如何测试是否连通,就不说了
==================AC命令,模式==============================

这部分是关键,但是由于教程实在讲得很细了,我就直接粘贴,做点注解好了

Using the Java Profiler with Java 1.4 (or lower) Virtual Machines

tptp对于jdk1.5之前与之后再agentControl上还是很有区别的,重点说JDK1.5后

Using the Java Profiler with Java 1.5 (or higher) Virtual Machines

1.agentlib:JPIBootLoader=JPIAgent[:[help]|[<option>=<value>,...]];<profiler>[:<option>=<value>,...]

这个是启动jvm时的参数,具体意义教程均有说明

server=[standalone | enabled | controlled]

standalone 独立模式,在这个模式下,eclipse是没有用的,所有参数均在命令行中,检测结束后,会有一个trace.trcxml文件,导入eclipse(file-import-profiling and logging-profiling file)后即可分析,查看(也就是说他是静态的)
The profiling agent runs in a headless mode, which means it is not possible to interact with it from the workbench. Configuration information is provided as part of the command lineand profiling data is stored in a file directly by the profiling agent. The profiling file can then be imported into the workbench at a later date.
The Java Profiling Agent is manually attached to a JVM instance and generates profiling data to an output file. The default output file is called trace.trcxml, but you can specify a different file name using the file= filename parameter. When this option is selected, the Java Profiling Agent produces an enclosing traceRoot element to form a complete and valid XML document.
enabled (This is the default.)这个最常用,在命令行中执行后,立马到eclipse中,在profiling configuration选项卡中找到   Attach to    Agent,在agent control选项卡中便可以看到正在运行的agent了。   注意,此时可以在EDIT OPTIONS中设置监控的类型等参数!
另外,需要注意的是,很多人说tptp监控tomcat等很慢,这个问题,一方面的确是tptp的 原因,但是最重要的是,他们没有设置过滤,监控了所有的包,尤其是在standalone模 式下,如果没有配置filters.txt那么所有的包都监控,机子的内存很快就会不行!
所以,一定要合适配置要监控的包,其他的全部exclude掉!
The profiling agent runs in the background of the JVM without consuming resources until it is connected to by the workbench and asked to start monitoring. Data is then streamed over the agent's data channel and consumed by the workbench. This mode allows the application to run normally, but produces no profiling data until a client attaches to the agent to give it instructions. When this option is selected, the Java Profiling Agent produces only XML fragments instead of a complete XML document.
controlled 这个和enable差不多The profiling agent preempts the JVM from initialization (the agent is loaded but it blocks the application from running) until it is attached to from the workbench and given instructions to start monitoring by a client. That is, when the profiling agent is launched in controlled mode, it will appear to hang the JVM until asked to start monitoring and it will produce only XML fragments instead of a complete XML document.
以下是我的启动脚本,注意Xmx Xms XX:MaxPermSize这些参数试具体情况而定
写道
java -Xmx1G -Xms512M -XX:MaxPermSize=512M -agentlib:JPIBootLoader=JPIAgent:server=standalone,filters=filters.txt;CGProf -classpath C:\test\liferay-portal-6.0.5\tomcat-6.0.26\bin\bootstrap.jar -Dcatalina.home=C:\test\liferay-portal-6.0.5\tomcat-6.0.26 -Dcatalina.base=C:\test\liferay-portal-6.0.5\tomcat-6.0.26 org.apache.catalina.startup.Bootstrap -config C:\test\liferay-portal-6.0.5\tomcat-6.0.26\conf\server.xml start
filters.txt 
com.company.* * INCLUDE
org.springframework.* * EXCLUDE
* * EXCLUDE

记录TPTP监控tomcat相关推荐

  1. 使用jvisualvm远程监控tomcat(阿里云ECS)

    写在前面:  使用jvisualvm远程监控tomcat(阿里云ECS),连接是报错:service:jmx:rmi:jndi/rmi:IP:端口//  连接到 IP:端口,网上找了很多资料,未能解决 ...

  2. bat脚本中获取上级目录_使用Python写一个可以监控Tomcat 运行的脚本,并且把.py文件转换成.exe文件...

    使用Python写一个可以监控Tomcat 运行的脚本,并且把.py文件转换成.exe文件 文章来源与博主本人的CSDN博客,博客地址:https://blog.csdn.net/weixin_435 ...

  3. tomcat 8集合memcache所需完整jar包_使用 zabbix 监控 tomcat(包含jvm监控)

    点击上方"民工哥技术之路"选择"星标" 每天10点为你分享不一样的干货  读者福利!多达 2048G 各种资源免费赠送 1.前言: 我们的监控系统是zabbix ...

  4. 使用 zabbix 监控 tomcat(包含jvm监控)

    点击上方"民工哥技术之路"选择"星标" 每天10点为你分享不一样的干货  读者福利!多达 2048G 各种资源免费赠送 1.前言: 我们的监控系统是zabbix ...

  5. linux cacti监控tomcat,Cacti监控Tomcat服务器实现过程

    1 首先去官网上面下载通用的监控模板 一般使用TomcatStats-0.1.zip 模板居多,下载地址: , 在linux服务器上面使用wget下载,wget,报如下错误: 正在连接 forums. ...

  6. 使用Zabbix监控Tomcat

    使用Zabbix监控Tomcat 服务器配置(zabbix_server) 一.安装Java环境 二.安装 zabbix-server 和 zabbix-java-gateway 三.修改监控端配置文 ...

  7. linux shell脚本攻略_(python)Linux下shell脚本监控Tomcat的状态并实现自动启动步骤...

    今天为大家带来的内容是:(python)Linux下shell脚本监控Tomcat的状态并实现自动启动步骤 本文内容主要介绍了Linux下shell脚本监控Tomcat的状态并实现自动启动的步骤,文章 ...

  8. zabbix 监控tomcat实例

    zabbix 监控tomcat实例 环境: CentOS 7.2 zabbix-3.0.5 LTS nginx-1.10.1 php-7.0.11 mariadb-10.1.18 tomcat-9 请 ...

  9. zabbix之通过jmx监控tomcat

    zabbix监控tomcat 1.编译zabbix的时候需要添加参数--enable-java 关于如何安装zabbix,可以参考上一篇文章http://blog.unix178.com/ 备份zab ...

最新文章

  1. 运行时常量池在哪里_C++干货系列——从编译期常量谈到constexpr(一)
  2. matlab绘制csv图片,Matlab处理csv文件与图形绘制总结
  3. 【Redis】9.10.Redis持久化方式之RDBAOFAOF和RDB区别场景分析
  4. MySQL-常用引擎
  5. recv原理、高阶版黏包解决方案、基于UDP的socket通信
  6. 《Python Cookbook 3rd》笔记(5.11):文件路径名的操作
  7. Easyui Datagrid的Rownumber行号显示问题
  8. 在Windows系统下安装RabbitMQ
  9. 使用Tenorshare iCareFone for mac如何对iPhone进行系统修复?
  10. PHP基础教程-54课-问题
  11. WIN10的WIFI不能自动链接?
  12. stata面板数据:xtserial下载问题解决
  13. VDN平台各种数据库连接设置
  14. 【C语言】有n个人围成一圈,顺序排号。从第1个人开始报数(从1到3报数),凡报到3的人退出,问最后留下的人是原来第几号。
  15. 计算机毕业设计之java+jsp517报刊图书征订管理系统
  16. substratum android8,如何在没有root的情况下在Android Oreo上安装Substratum主题
  17. 计算两个时间相差多少小时、分钟、秒
  18. Android go app 安装包,安卓go系统刷机
  19. sql操作报空指针异常
  20. 如何进行格式转化?几招帮你搞定格式转换

热门文章

  1. JSON的正确格式及JSON与实体类相互转换
  2. MATLAB 赋值具有的非单一 rhs 维度多于非单一下标数
  3. 演讲 口才 思维导图
  4. python修改二进制文件_python二进制修改bcwav文件
  5. 使用Aspose组件将WORD、PDF、PPT转为图片
  6. 自动采购订单 Auto PO
  7. 基于STM32的倾斜仪设计(二)—— 硬件设计(2)
  8. Qt 直接在控件上拖拽图片到桌面、QQ
  9. 教你在WORD中如何制作三线表
  10. spring boot项目报错:Validation failed for query for method public abstract...