首页 > 其他分享 >性能分析插件

性能分析插件

时间:2022-10-01 21:39:46浏览次数:50  
标签:分析 07 插件 p6spy 性能 56 SQL 08 21

  • pom.xml
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
</dependency>
  • spy.properties
modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory
# 自定义日志打印
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
#日志输出到控制台
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
# 使用日志系统记录 sql
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
# 设置 p6spy driver 代理
deregisterdrivers=true
# 取消JDBC URL前缀
useprefix=true
# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
excludecategories=info,debug,result,commit,resultset
# 日期格式
dateformat=yyyy-MM-dd HH:mm:ss
# 实际驱动可多个
#driverlist=org.h2.Driver
# 是否开启慢SQL记录
outagedetection=true
# 慢SQL记录标准 2 秒
outagedetectioninterval=2
  • 配置类
@Configuration
public class MybatisPlusConfig {

// 该插件 3.1.2 后版本废弃,推荐使用
// @Bean
// public PerformanceInterceptor performanceInterceptor(){
// //启用性能分析插件
// return new PerformanceInterceptor();
// }
}
  • 测试
@SpringBootTest
public class PerformanceTest {

@Autowired
private StudentMapper studentMapper;

@Test
public void test(){
studentMapper.selectList(new QueryWrapper<>());
}

}
  • 控制台
 Consume Time:2 ms 2022-07-21 08:56:49
Execute SQL:DROP TABLE IF EXISTS student

Consume Time:6 ms 2022-07-21 08:56:49
Execute SQL:CREATE TABLE student ( id BIGINT (20) NOT NULL COMMENT '主键ID', name VARCHAR(30) NULL DEFAULT NULL COMMENT '姓名', age INT (11) NULL DEFAULT NULL COMMENT '年龄', PRIMARY KEY (id) )

Consume Time:1 ms 2022-07-21 08:56:49
Execute SQL:DELETE FROM student

Consume Time:1 ms 2022-07-21 08:56:49
Execute SQL:INSERT INTO student (id, name, age) VALUES (1, 'Jone', 18),(2, 'Jack', 20),(3, 'Tom', 28), (4, 'Sandy', 21),(5, 'Billie', 24)

_ _ |_ _ _|_. ___ _ | _
| | |\/|_)(_| | |_\ |_)||_|_\
/ |
3.5.2
2022-07-21 08:56:50.000 INFO 12328 --- [ main] c.b.samples.performance.PerformanceTest : Started PerformanceTest in 1.543 seconds (JVM running for 2.706)
Consume Time:2 ms 2022-07-21 08:56:50
Execute SQL:SELECT id,name,age FROM student



标签:分析,07,插件,p6spy,性能,56,SQL,08,21
From: https://blog.51cto.com/chniny/5728432

相关文章

  • sql执行分析
    pom.xml<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId></dependency>application.ymlmybatis-plus:global-co......
  • 防全表更新与删除插件
    ​​官方文档​​配置类@ConfigurationpublicclassMybatisPlusConfig{@BeanpublicMybatisPlusInterceptormybatisPlusInterceptor(){MybatisPlusInte......
  • 多租户插件
    ​​官方文档​​配置类@Configuration@MapperScan("org.example.demo15.mapper")publicclassMybatisPlusConfig{/***新多租户插件配置,一缓和二缓遵循mybatis......
  • 动态表名插件
    ​​官方文档​​pom.xml,注意mybatisplus版本需高于3.4.3.2<dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spr......
  • ELK日志分析平台架构剖析和常见问题
    一、什么是ELFK1、ELK已经成为目前最流行的集中式日志解决方案,分别表示:Elasticsearch,Logstash,Kibana,它们都是开源软件。新增了一个FileBeat,它是一个轻量级的日志收......
  • 实验3:OpenFlow协议分析实践
    完成拓扑搭建,完成相关IP配置,并实现主机与主机之间的IP通信。用抓包软件获取控制器与交换机之间的通信数据。HelloOpenFlow:1.0Port:6633-->55062Seq:1Ack:1......
  • 恶意代码分析 动态行为分析 Lab3-1
    Lab3-1使用动态分析基础技术来分析lab03-01.exe 目录Lab3-11.找出这个恶意代码的导入函数与字符串列表2.这个恶意代码在主机上的感染迹象特征是什么3.这个恶意代码......
  • python-数据描述与分析(1)
    数据描述与分析  在进行数据分析之前,我们需要做的事情是对数据有初步的了解,这个了解就涉及对行业的了解和对数据本身的敏感程度,通俗来说就是对数据的分布有大概的理解,......
  • 案例分享:Qt国产麒麟系统某防“某显示控制项目”(多类设备自动化流程控制,数据分析整合与
    喜报  我司承担的某防“某显示控制项目”,已于近日顺利通过湖底验收。<br>需求  功能简介:  1.多类设备的显示、控制与管理  2.数据的分析与展示,定位图、深度图......
  • nc这个工具用于伪造c2服务器 做c2初始连接的抓包分析实在是太tm好用了!必要时候配合APA
    DNSSpoofingwithAPATEDNS20thFebruary2015Wannes.ColmanLeaveacommentIfyou quicklywanttofindoutwhatthemalwareinyoursandboxisresolving,......