最近发现一个做springboot项目性能分析的工具,配置简单,功能强大~
简介
koTime是一个springboot项目性能分析工具,通过追踪方法调用链路以及对应的运行时长快速定位性能瓶颈
快速配置
只需要修改两个文件
- pom.xml
<dependency>
<groupId>cn.langpy</groupId>
<artifactId>ko-time</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
<version>2.3.12.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>2.3.12.RELEASE</version>
</dependency>
2. application.yml

配置需要监测的切面范围,语法参考aop的@pointcut ko-time: pointcut: execution(public * com.这个包下面的都要监测...(..))
理论上项目配置这两个地方就可以了,需要更加详细的配置可以参考官方介绍:
结果测试
在浏览器中打开地址http://localhost/koTime

用postman调用接口,再次刷新会发现接口数变成了1(KoTime的这个界面只会统计调用过的接口)

点击接口列表查看接口调用链路

点击该接口可以查看详细调用链路(包括在接口调用的时候调用的所有方法的平均耗时、最大耗时、最小耗时、异常数目),在此基础上可以轻松快速的定位需要优化的位置!

完成~撒花🎉🎉🎉~~
网友评论