benchmarksql测试mysql_BenchmarkSQL对数据库性能测试示例

BenchmarkSQL对数据库性能测试示例

最近在做TIDB的上线部署,部署完成后需要对其进行性能测试,所以我们就用了benchmarkSQL这个工具啦

#首先我们需要下载benchmarksql

git clone -b 5.0-mysql-support-opt-2.1 https://github.com/pingcap/benchmarksql.git

#安装好 java , ant

sudo yum install -y java ant

#构建ant

cd benchmarksql

ant

#远程复制服务命令:(将下载好的benchmarksql通过scp远程复制到指定服务器,如果网络是通的则可以直接SecureFX上传)

scp -r [email protected]:/home/user/tidb/benchmarksql ./

接下来我们就要开始准备测试数据库性能了,这里我们是使用benchmarksql测试tidb (和Mysql类似,所以我们会参考mysql的配置信息来做调整)

1.参考 benchmarksql/run/ props.mysql 配置文件

db=mysql

driver=com.mysql.jdbc.Driver

conn=jdbc:mysql://localhost:4000/tpcc?useSSL=false&useServerPrepStmts=true&useConfigs=maxPerformance&rewriteBatchedStatements=trueuser=root

password=warehouses=1loadWorkers=4terminals=1

//To run specified transactions per terminal-runMins must equal zero

runTxnsPerTerminal=0

//To run for specified minutes-runTxnsPerTerminal must equal zero

runMins=10

//Number oftotal transactions per minute

limitTxnsPerMin=0

//Set to true to run in 4.x compatible mode. Set to false to usethe//entire configured databaseevenly.

terminalWarehouseFixed=true//The following five values must add up to 100

//The default percentages of 45, 43, 4, 4 & 4 match the TPC-C spec

newOrderWeight=45paymentWeight=43orderStatusWeight=4deliveryWeight=4stockLevelWeight=4

// Directory name to create forcollecting detailed result data.// Comment this out tosuppress.

resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS//osCollectorScript=./misc/os_collector_linux.py//osCollectorInterval=1

//osCollectorSSHAddr=user@dbhost

//osCollectorDevices=net_eth0 blk_sda

warehouses=40 # 使用 40个 warehouse

terminals=100 # 使用 100个终端

loadWorkers=10 # 导入数据的并发数

参考以上配置文件新建我们自己的测试配置文件 benchmark_tidb.properties 并调整参数信息:(需要先新建对应的库信息 在数据库中新建数据库:benchmark_test )

db=mysql

driver=com.mysql.cj.jdbc.Driver

conn=jdbc:mysql://10.55.33.44:4000/benchmark_testuser=root

password=warehouses=40loadWorkers=10terminals=100

//To run specified transactions per terminal-runMins must equal zero

runTxnsPerTerminal=0

//To run for specified minutes-runTxnsPerTerminal must equal zero

runMins=2

//Number oftotal transactions per minute

limitTxnsPerMin=0

//Set to true to run in 4.x compatible mode. Set to false to usethe//entire configured databaseevenly.

terminalWarehouseFixed=true//The following five values must add up to 100

//The default percentages of 45, 43, 4, 4 & 4 match the TPC-C spec

newOrderWeight=45paymentWeight=43orderStatusWeight=4deliveryWeight=4stockLevelWeight=4

// Directory name to create forcollecting detailed result data.// Comment this out tosuppress.

resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS//osCollectorScript=./misc/os_collector_linux.py//osCollectorInterval=1

//osCollectorSSHAddr=user@dbhost

//osCollectorDevices=net_eth0 blk_sda

2.开始运行 进入benchmarkSQL的run目录,依次执行以下命令

./runSQL.sh benchmark_tidb.properties ./sql.common/tableCreates.sql

./runSQL.sh benchmark_tidb.properties ./sql.common/indexCreates.sql

./runDatabaseBuild.sh benchmark_tidb.properties

./runBenchmark.sh benchmark_tidb.properties

netstat -tlnp #说明 l:listening t: tcp n:number p:process

原文:https://www.cnblogs.com/DFX339/p/13071848.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值