性能测试中,我们经常希望一个平台能拦截、profile、分析性能数据,现实在一点点逼近.Jwebap:51Testing软件测试网v)?F?#|+{sI$^
效果图http://www.jwebap.org/detect/console/?null51Testing软件测试网v|&?.} Pp;g
8Z%WOR%~WW9Y0官方文档:http://www.jwebap.org/index_zh.htm51Testing软件测试网J Ni$y^2RE4ej#mI
0a~r"mX^a*p!}MtL(c0作者blog:http://leadyu.javaeye.com/51Testing软件测试网7f%mF-?4y)O;E51Testing软件测试网&~0Ui-iAS-RQ
Jwebap是无代码侵入、需要修改.xml配置文件的应用监控工具,轻易获取jdbc调用/http调用、方法调用耗时及是否有jdbc泄露。核心原理:应用asm字节码操作框架实现动态monitor。51Testing软件测试网X)|y
fqw:S
.wk"uZM|2pU0另外一个工具:http://jamonapi.sourceforge.net/。51Testing软件测试网$n9[+U,x;} x%j;Z:yN
,?(d5Z$P+s01.1.1 下载
-v6??gut0http://sourceforge.net/projects/jwebap/files/5z~NsF6qU u051Testing软件测试网,R`|:sS;X*['x
1.1.2 部署
#te%lp0La0解压后的jwebap_0.6.1.jar, tracer_0.6.1.jar及jwebap_0.6.1_all\lib目录下jar复制到jboss-4.2.2.GA\server\default\lib目录下。51Testing软件测试网Ge2s:KY,q\+P9s&t/}
1}&?\Gyn!n@0修改tracer_0.6.1.jar/META-INF/plugin.xml文件,红色为修改项:"d6Y YV%ME0YK0
%^C"uG"a z0<?xml version="1.0" encoding="UTF-8"?>51Testing软件测试网1HC*hJ9E n8C,g,z8[
^6t_
AmTI[051Testing软件测试网,dX$kLT HEYry51Testing软件测试网(Qm-P&Lw"m8Ot;M#o
h
k^}W-s051Testing软件测试网QP AM{(M&BC5v
51Testing软件测试网ur$rnVO:B
H4b-o1t
v~ k03I5R+e
zX%qh`b0
t1?tXH])^$m0trace-filter-active-time*R-T2fw1c051Testing软件测试网UB1bbr3BA!{
K8n
-151Testing软件测试网.^H
Z#E7G5f.[:Q51Testing软件测试网L~$fv1X9i7h
(ms) timings filter's over time51Testing软件测试网6TbH7L5S&DK/I;@C51Testing软件测试网%umb
|UHp:P
[c1Mu/S%`3q0
0J$a2Q!]IF0!gnCTZ)h:~eC0
y:v@,me:i{Rq0trace-max-sizehE9^ZYGQ051Testing软件测试网:]9f;}@bU
100051Testing软件测试网9|fO%Y#Pw1P
8{rV0\2zp;nX0max over-time trace size51Testing软件测试网'vH8Z n*z} z xM s51Testing软件测试网Fa;f)TG5g1xM
9K3Z4`)e7wf~"IU0t3w#`0
*S'U)OF-J@0*n4]H!]o]+z.D0
9F0a$h$`%W%f\
gth0H
N.OFW0
TYA`mgRu:DQ|051Testing软件测试网o5y"R-nF.f}
l"D!u:L?|0trace-filter-active-timeA.aA`u8j!e051Testing软件测试网%}v|!o#?|
-1*[.o N2m0v3C5x#lm051Testing软件测试网Z'Q"^?+[0w+RT|"R+V
(ms) timings filter's over time51Testing软件测试网L)U2GH6JW1W51Testing软件测试网aG3g4k3m!]h
51Testing软件测试网(y8Bw}/_bun51Testing软件测试网,~i I%M})Z?
RiTC*J!hyR0
^S?]"Hzw j0trace-max-size51Testing软件测试网3l4CY#g#@#r9W
;xFW*Y!Rc@e010005C.Up$G\uMpMeI051Testing软件测试网?Wjho.w
max over-time trace size$[_,o(C/_F}0
*_({G2M ^^051Testing软件测试网v?Hs6h^51Testing软件测试网c(n5N0W ]qN
51Testing软件测试网~+iw"@*Yl
M#LA8li$Yj"{1Li5ub0detect-clazzsk/wj:_+K"b/QJ'gk051Testing软件测试网.S!zJa'Lc,mvF
51Testing软件测试网)T
K1XCf(M51Testing软件测试网2?Z%`7v"_*u!N
com.ali.*;M
y;E9Wx051Testing软件测试网kH7@$QbfV
}!QM7x
51Testing软件测试网/E \X~y]7iv/Y:gF
8]t{ L*vG?$_\4{-mY051Testing软件测试网/GZST X1i|;FG
j@TG;@DZ&n0package name and class name that monitored by MethodComponent,6m7Q[3Do051Testing软件测试网\!GOM/d+bB
e.g.: 'test.*;test.Test' , divided by ';'?&D#Nk?,N5xQ051Testing软件测试网@^O(V.v
S
51Testing软件测试网8c4D mO#Tc
I\O}3pS}{nx:@051Testing软件测试网A4vY,K PlnJpU8b
'BlH _%N\NN02Jr:QCFJ0
-L\9CAt*gpg J0{vcVh#n5l j{0
#az6S$Y'S@vVKP`051Testing软件测试网H.F:gRzn9^!e
!u;y:NO!F"mD0trace-filter-active-time51Testing软件测试网%y_6o/wM4H t$W({51Testing软件测试网,f:\El _U
-1d9hv2aD7_:E+{&OR051Testing软件测试网-ktwSN9U$?1d
(ms) timings filter's over time51Testing软件测试网
e*l-Spq!g
rED#AW#X051Testing软件测试网J:b$F};^
RzXe
@F%?0&`9TB-h tC0
g-J2bY}3R0trace-max-size51Testing软件测试网&V3S(b+j`-hZ]\,xI
&R3{m,nCz~ g0100051Testing软件测试网vI1H*zc$b5D|
"n
qo2jcf6q8I0C0max over-time trace size51Testing软件测试网,~GBb(t&{WU$q
@"K}8R.JX(^0PO mVIp)Z/F&A0
,`^aXa0/B~1V"RM|0
4[[~7C~.Lq'|0connection-listener51Testing软件测试网*Hs&G*IBC1q R)h
3H9z*?r#N!W:Ag[4T051Testing软件测试网:\~s8~W'Z51Testing软件测试网(FZ?o)^zB
org.jwebap.plugin.tracer.http.ServletOpenedConnectionListener;org.jwebap.plugin.tracer.method.MethodOpenedConnectionListenerPG,I8[&h)M/c!Z2|-y^0
M8cB9S2Y*w6dKR051Testing软件测试网MNdE3rPs!VR
*Og.?\(_M*Kf/w0Connection ListenerA2M-P}{4L"^6V0
|6p;~K1W|Xz;J2z9u0k.S~&N,oE%mN0
DPG7D$]051Testing软件测试网;C(w"KG+a-}
9mD@mKYm0P0driver-clazzs0m9x-^w3Z:`;v051Testing软件测试网"dO@^Fg@'toS
org.apache.commons.dbcp.BasicDataSource2N!r2c%E| od051Testing软件测试网CFG[2MFRp
51Testing软件测试网/o,J+a2K-b"n
DQ~^Mg0KG051Testing软件测试网%L.S!z3m'f3X7~k
2t IhCBP0 51Testing软件测试网xw2k2{Niun7u6u
n:_y1Hm2H*?0m`0Z9`9pi C051Testing软件测试网6fiH-tJ+hY
"Y$G jMd#@051Testing软件测试网)~,u0XB,O[*B,^X
51Testing软件测试网(I
h"U0i-NDK5zJ
s!v'n?-p(?(X7X0…bW@QL+K051Testing软件测试网(p'HfE?
L1ymbI0
4U\"~D0e]0修改好后重新替换入jar。如下是监控spring.war应用的操作过程。51Testing软件测试网g:CO@#X!p7X
{X1KMMO+{C0修改jwebap.xml放到jboss-4.2.2.GA\server\default\deploy\spring.war\WEB-INF1@4u ZPV?lDe051Testing软件测试网5}_BR*eC:H
<?xml version="1.0" encoding="UTF-8"?>V5C"n){C;kaEcK0
oo}RCR051Testing软件测试网8J$v\3`VR6E|+f51Testing软件测试网d8XP;Z Q
51Testing软件测试网'S
Mn;YCkfW51Testing软件测试网A[9VL-?:SI
51Testing软件测试网*_$R ~:t+y@e:H ?^51Testing软件测试网?E`Mi}
…51Testing软件测试网4T L{Z m5g
]51Testing软件测试网+K6mR"gg:N{~O*t9O5H
9PeJ4]9Nq0
%i$Z^hA#S$g.Hej0
1SCE2d-J7CD0(${ABSOLUTE_PATH}是内置的变量,不必修改)51Testing软件测试网rr/S1@Y%ga9nQo
5f$ZG1NUlPh+o0参考jwebap_0.6.1_all\bin\web-example.xml修改jboss-4.2.2.GA\server\default\deploy\spring.war\WEB-INF\web.xml:51Testing软件测试网c?q q&EY51Testing软件测试网&Y Ah3?WOBVsx
51Testing软件测试网$xp8G(d"zQa
1b k*lw1do%_5X&L&B0
s6E(q`#nJe;Z051Testing软件测试网SJl6f&K?M51Testing软件测试网gH%a5["r K7TC
jwebap-configq|r \z9`0
8b}'^k^jk
sp0/WEB-INF/jwebap.xml'd(Nu7g&WR0
(\r$i?9P4j!?5q*T051Testing软件测试网 f~@$Xeu N51Testing软件测试网\k+EO5Hs'd
51Testing软件测试网\!} ]X-R\E1?51Testing软件测试网1Z8]dI:}d+Gs]P
org.jwebap.startup.JwebapListener51Testing软件测试网q2cK_
wk qH2S51Testing软件测试网5~+s$z%JC]#eg
fGM)\7K0
'ojJU$z@Kd051Testing软件测试网&o%hRQ&`7IJ [ V51Testing软件测试网 |K;F.V^T$R7m
PageDetectFilterMH?m^1Z0
2}*T u5{N!w%V2d0org.jwebap.plugin.tracer.http.DetectFilterj5L"tkQ0
^AgA%w~i#F/Z3?051Testing软件测试网5k/xYuL,zu!k |P~51Testing软件测试网/X;AW']xf*~a
excludeUrls6\g'W,M b051Testing软件测试网5@#nr{yX
/detect;/detect/*;*.js;*.jpg;*.htm;*.html;*.gif;*.png;*.css;*.swf51Testing软件测试网I;B)Qa%V*bh2d
gM H fj?j0k$J4V/dYo R051Testing软件测试网Asb*F(a8G&c
51Testing软件测试网 S.z#Q}dR9o
V;X;wc|AmVU0qy2`/ZR(Ko-[-f0
3mtRhe*U4o0PageDetectFilter51Testing软件测试网QN{LTf51Testing软件测试网s'M+Q;g LK*_
/*51Testing软件测试网XBQ(d"@bl8~~%a1l@51Testing软件测试网!D-g)d @5e)F Y9e&q.W
51Testing软件测试网4a%|,Fa,V;o7Y^ u8EU
$a,`^C*g.M%v.t5d7n0 51Testing软件测试网c*S'o|N8x/iU`
^)z'Qz:B.d0k,[4hi'm/j051Testing软件测试网n4Ex(fM(Mp
detect'`+Kfqc`L6U0
z
\WY G9i2{9mS0org.jwebap.ui.controler.JwebapServletJ$}{5Cuc$X)phvRn051Testing软件测试网(qx1`9M9{ ej
)D e5S [
rX051Testing软件测试网z
f/j*P:P,S6iky
51Testing软件测试网5{7t1T@ p.Y
-C9@c8gjS4y051Testing软件测试网1i+l#_@M
%_LiQ:u-|0detect51Testing软件测试网n'G2dEv'Vn0Z51Testing软件测试网(Zh`'P6v3e
/detect/*51Testing软件测试网xhi7uDq/l7W
@xBp;o4z9K
o`051Testing软件测试网0o6kD:U#g)S
h8l8r#bx9M)z(b@0K0ihT;}m!@8Jb0
cp"Q"^
R&?051Testing软件测试网P~d
E,C,{D ~51Testing软件测试网a3AMM7L5i|Hr
\
有一点特别注意的是,在被监控的程序如spring.war目录jboss-4.2.2.GA\server\default\deploy\spring.war\WEB-INF\lib加入驱动程序如commons-dbcp.jar,否则无法获取jdbc trace数据。t;a&hv8f\.V}0
i
A4J5Xs7q @g0
.M3z
|M)q_01.1.3 启动应用及拦截51Testing软件测试网sF;BW@@rJO%M
启动jboss,51Testing软件测试网!^
cT[iJH2InB&R