作者: lfjiang 原文来源:https://tidb.net/blog/da4d7948
声明:本文章只介绍用 TPCCRuner 工具测试 TiDB 7.5.4,集群请提前准备。
TPCC 工具准备
1、下载 tpcc 源码包
https://sourceforge.net/projects/tpccruner/files/TPCCRunner_SRC_V1.00.zip/download
2、解压并编译源码包
unzip TPCCRunner_SRC_V1.00.zip
cd src
javac -d ../bin ./iomark/TPCCRunner/*
mkdir log
TPCC 配置修改
conf/example/mysql 下有 4 个文件,其中
loader.properties
为数据准备配置
master.properties slave1.properties slave2.properties
为数据压测配置
conf/example/mysql/loader.properties
配置如下
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://10.2.xxx.xxx:4000/tpcc?characterEncoding=UTF-8&useServerPrepStmts=true&rewriteBatchedStatements=true&allowMultiQueries=true
user=root
password=root
threads=100
warehouses=1000
复制代码
master.properties
配置如下:
listenPort=27891
slaves=slave1,slave2
runMinutes=50
warmupMinutes=10
newOrderPercent=1
paymentPercent=1
orderStatusPercent=45
deliveryPercent=43
stockLevelPercent=10
newOrderThinkSecond=0
paymentThinkSecond=0
orderStatusThinkSecond=0
deliveryThinkSecond=0
stockLevelThinkSecond=0
复制代码
slave1.properties
配置如下:
name=slave1
masterAddress=10.2.xxx.xxx
masterPort=27891
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://10.2.xxx.xxx:4000/tpcc?characterEncoding=UTF-8&useServerPrepStmts=true&rewriteBatchedStatements=true&allowMultiQueries=true
user=root
password=root
poolSize=100
userCount=100
warehouseCount=500
startWarehouseID=1
复制代码
slave2.properties
配置如下:
name=slave2
masterAddress=10.2.xxx.xxx
masterPort=27891
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://10.2.xxx.xxx:4000/tpcc?characterEncoding=UTF-8&useServerPrepStmts=true&rewriteBatchedStatements=true&allowMultiQueries=true
user=root
password=root
poolSize=100
userCount=100
warehouseCount=500
startWarehouseID=501
复制代码
准备数据
参考 readme.txt
MySQL
username: root
password: xxxxx
1. Create Database
mysql -uroot -pxxxxxx -P4000 -h 10.2.xx.xx -vvv < sql/example/mysql/create_database.sql
2. Create Table
mysql -uroot -pxxxxxx -P4000 -h 10.2.xx.xx -vvv < sql/example/mysql/create_table.sql
3. Load Data
java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Loader conf/example/mysql/loader.properties
4. Create index
mysql -uroot -phuawei -vvv -n < sql/example/mysql/create_index.sql
复制代码
运行 TPCC
参考 readme.txt
Run Master
java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Master conf/example/mysql/master.properties
Run Slaves on Clients
java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Slave conf/example/mysql/slave1.properties
java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Slave conf/example/mysql/slave2.properties
复制代码
而我这里放到脚本里了,如下:
cat run.sh
nohup java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Master conf/example/mysql/master.properties &
sleep 1
nohup java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Slave conf/example/mysql/slave1.properties &
sleep 1
nohup java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Slave conf/example/mysql/slave2.properties &
复制代码
sh run.sh
进行启动
目前启动后,日志 errlog 异常,仍在排查。
评论