JAVA 性能监视 JAMON can be with SpringWeb or jwebap

来源:互联网 发布:网络布控中心 编辑:程序博客网 时间:2024/05/11 16:36

http://www.infoq.com/cn/articles/java-profiling-with-open-source

E:\>jps4344 bootstrap --> tomcatG:\paul>jmap -histo:live 4344 > G:\jmap.txt


 
num     #instances         #bytes  class name----------------------------------------------   1:         20153        3273216  [C   2:         21429        2548128  <constMethodKlass>   3:         32644        2060096  <symbolKlass>   4:         21429        1716016  <methodKlass>   5:          2301        1188528  <constantPoolKlass>   6:          5990         988904  [B   7:          2301         944304  <instanceKlassKlass>   8:          1996         698608  <constantPoolCacheKlass>   9:         21322         511728  java.lang.String  10:          3717         297360  java.lang.reflect.Method  11:         11233         269592  java.util.HashMap$Entry  12:          2547         244512  java.lang.Class  13:          3406         191312  [S  14:          1269         183040  [Ljava.util.HashMap$Entry;







The Java Application Monitor (JAMon) is a free, simple, high performance, thread safe, Java API that allows developers to easily monitor production applications. 1) It contains the ability to monitor JDBC/SQL, web page requests, ejb's, log4j, interfaces and more. 2) It tracks aggregate stats for each sql statement, page request etc. and also lets you look at this information and more via the JAMon war. 3) You can also access JAMon statistics via the api

http://mvnrepository.com/artifact/com.jamonapi/jamon/2.75


优化程序之前,可用Jamon来监测你的Spring应用

http://www.iteye.com/topic/112172


用jamon来监控你的sql执行效率

http://www.iteye.com/topic/164758



from he:http://leadyu.iteye.com/

看了下jamon,应该说jwebap在部署方面真的简单太多了。 

首先,jwebap对于jdbc的监控,根本不需要代理数据源,也不需要实现特定的代理驱动。而且jamon这种方式应该是没法监控jndi数据源的(从我初步从它的配置文档了解到的,我只能说应该:-) ) 

另外,对于EJB的监控,Jwebap也根本不需要配EJB的代理,只要在method plugin的'detect-class'参数里,配置想监控的包名即可,如"test.ejb.*;com.ejb.*;" 

jwebap的部署,只需要丢个jar包,配下jwebap.xml 和对应的web.xml即可。 


我觉得可以这么归结:
 

第一代prfiling tools:基于代理,代理,又代理的思想,实现monitor。缺点是,部署麻烦,甚至是还需要修改项目代码才能部署,功能也不强。比如jamon和P6SQL 

第二代prfiling tools:基于专属平台JVMPI,缺点:给系统带来了10-20倍的性能负担,同时部署复杂,但是,功能强大,如jprofiler 

第三代prfiling tools:出现了BCEL,后更有ASM等字解码指令操作框架,介于jdk14-15之间。基于字解码操作,profiling实现了真正意义的动态monitor。这种profiling部署简单,性能高,但是功能不算非常强大。 

第四代prfiling tools:出现jdk instrument。更有aspectJ。这时profiling功能得到增强,但是丢失了大量停留在jdk14的用户,同时部署也不简单。 


Jwebap从这种划分,应该说,处于第三代和第四代之间,Jwebap-core采用第三代技术,plugin则很任意,介于第四代技术。

with spring:

http://cpjsjxy.iteye.com/blog/1612317 


开始改造 jwebap 持久化其监控数据,及其分页:

debug追踪至:

org.jwebap.plugin.tracer.http.HttpRequestTrace
\org\jwebap\plugin\tracer\util\TimeFilterViewHelper.java


用log4j记录jwebap的trace轨迹数据:

修改:org\jwebap\plugin\tracer\TimeFilterAnalyser.java -->方法: inactiveProcess(Trace trace)

导出轨迹数据后其为html格式,可修改以下 formatter:

HttpRequestTrace

SQLConvertor

0 0
原创粉丝点击