Profiler摘要日志框架

目的

打印系统的性能分析日志,香港服务器,用于分析系统性能

一.maven依赖

<dependency><groupId>com.duowan.common</groupId><artifactId>duowan-common-log</artifactId><version>1.0.5</version></dependency><dependency><groupId>com.duowan.common</groupId><artifactId>duowan-common-util</artifactId><version>1.0.8</version></dependency>

二.配置

1.web.xml filter配置

拦截需要性能分析的URL,被拦截的方法启动子任务分析:start(requestURI),release()

<!– Profiler性能分析Filter –><filter><filter-name>ProfilerLoggerFilter</filter-name><filter-class>com.duowan.common.log.filter.ProfilerLoggerFilter</filter-class></filter><filter-mapping><filter-name>ProfilerLoggerFilter</filter-name><url-pattern>*.do</url-pattern></filter-mapping>

顺德

2.spring方法拦截器配置

拦截需要性能分析的方法及类,被拦截的方法启动子任务分析:enter(),release()

<bean/><!– 拦截有@Profiled标注的类或者方法 –><bean><property value=”true”/><property><value>profiledAnnotationPointcutAdvisor</value></property><property><list><value>userGameServerDao</value><value>userGameServerService</value></list></property></bean>

三.日志打印结果

1. 日志打印位置

# DWPROJECTNO是环境变量中的配置,香港服务器,profilerLogDir整个配置可以通过System.properties覆盖profilerLogDir=/data2/log/${DWPROJECTNO}/

2. digest-profiler.log

#动作时间,耗时(单位毫秒),动作ID,成功标志(Y为成功,其它为错误),美国服务器,循环执行次数(loopCount),方法执行结果(resultSize),clientIp2012-10-16 00:06:20.586,0,UserGameServerBatchCallback|userDataBatchUpdater.init|saveUserGameServerList,Y,1,0,2012-10-16 00:06:20.591,0,UserGameServerBatchCallback|userDataBatchUpdater.init|saveUserGameServerList,Y,1,0,2012-10-16 00:06:20.613,0,UserGameServerBatchCallback|userDataBatchUpdater.init|saveUserGameServerList,Y,10,0,2012-10-16 00:06:20.63,1,UserGameServerBatchCallback|userDataBatchUpdater.init|saveUserGameServerList,Y,13,0,2012-10-16 00:06:20.642,0,UserGameServerBatchCallback|userDataBatchUpdater.init|saveUserGameServerList,Y,2,0,2012-10-16 00:06:20.659,1,UserGameServerBatchCallback|userDataBatchUpdater.init|saveUserGameServerList,Y,16,0,2012-10-16 00:06:20.696,0,UserGameServerBatchCallback|userDataBatchUpdater.init|saveUserGameServerList,Y,1,0,

3. dump-profiler.log

[totalCost:25,555ms (selfCost:25,543ms), all:100% start:0ms ] – UserBatchCallback+—[totalCost:7ms, parent:0%, all:0%, loopCount:10,000, TPS:1,428,571 start:25,543ms ] – userDataBatchUpdater.init+—[totalCost:4ms, parent:0%, all:0%, loopCount:10,000, TPS:2,500,000 start:25,550ms ] – UserBatchCallback.loopProcessVisitable`—[totalCost:1ms, parent:0%, all:0%, loopCount:7,691, TPS:7,691,000 start:25,554ms ] – UserBatchCallback.flush

字段含义

上海

四. API使用

1.最简使用

切换行号显示;() {= .(= }..}未经一番寒彻骨,焉得梅花扑鼻香

Profiler摘要日志框架

相关文章:

你感兴趣的文章:

标签云: