代码拉取完成,页面将自动刷新
同步操作将从 闲.大赋(李家智)/dao-benchmark 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
dao 性能测试,包含jpa,myabtis,beetlsql等Dao工具,测试了插入,修改,查询,翻页查询等常用操作性能,以此来优化BeetlSQL性能
1 git clone https://gitee.com/xiandafu/dao-benchmark 2 mvn clean package 3 java -jar -Dtest.target=jpa target/dao-0.0.1-SNAPSHOT.jar 4 测试目标可更换为jpa,beetlsql,myabtis(还不支持) 5 在result目录检测测试文本结果
采用H2内存数据库,如下配置
#db config
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:dbtest
spring.datasource.schema=classpath:db/schema.sql
#spring.datasource.data=classpath:db/data.sql
# test config
test.target = beetlsql
test.warmCount=2
test.count=1000
#beetlsql config
beetlsql.mutiple.datasource=datasource
beetlsql.ds.datasource.basePackage=com.ibeetl.dao.beetlsql
beetl-beetlsql.dev=false
beetl.enabled=false
BeanchmarkApplication 是程序入口,启动后即可做测试
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
test(warmCount,false);
test(testCount,true);
};
}
可以设定预热次数,以及是否记录日志。
测试完毕,自动打印每个测试的方法并记录到文件系统里,位于程序运行的result目录,每个文件内容如下
#beetlsql,total: 1000
#Tue May 22 22:44:08 CST 2018
testAdd=194
testExample=45
testPageQuery=88
testUpdateById=93
testUnique=80
参考TestServiceConfig,提供一个TestServiceInterface接口实现
@Configuration
public class DataSourceConfig {
@Bean
@ConditionalOnProperty(name = "test.target", havingValue = "beetlsql")
public TestServiceInterface getBeetlSqlTestService() {
return new BeetlSqlPerformaceTestService();
}
@Bean
@ConditionalOnProperty(name = "test.target", havingValue = "jpa")
public TestServiceInterface getJpaTestService() {
return new JpaPerformaceTestService();
}
}
测试1000次操作所需要耗费的时间(毫秒),耗费时间越少,性能越好
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。