status
Published
date
Aug 1, 2021
slug
summary
category
技术分享
tags
数据库
测试
1 安装
相关软件
- Java
- ant
- benchmarksql
1.1 安装java
1、下载jdk1.8
2、解压jdk
sudo tar -zxvf jdk-8u241-linux-x64.tar.gz -C ~/app
3、使用
sudo vi /etc/profile
,在/etc/profile
后面添加# Java
export JAVA_HOME=/home/ubuntu/app/jdk1.8.0_212
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
4、配置刷新
修改完后,使用
source /etc/profile
刷新5、验证安装
使用
java -version
和javac -version
验证java安装是否成功。1.2 安装ant
sudo apt install ant
1.3 安装benchmarksql
git clone https://github.com/pingcap/benchmarksql
cd benchmarksql
ant
cd run
./runDatabaseBuild.sh props.mysql
./runBenchmark.sh props.mysql
修改
props.mysql
db=mysql
//driver=com.mysql.jdbc.Driver
driver=com.mysql.cj.jdbc.Driver
conn=jdbc:mysql://localhost:3306/tpcc?useSSL=false&useServerPrepStmts=true&useConfigs=maxPerformance&rewriteBatchedStatements=true user=root
password=123456 warehouses=1 loadWorkers=4 terminals=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 of total transactions per minute
limitTxnsPerMin=0
//Set to true to run in 4.x compatible mode. Set to false to use the
//entire configured database evenly.
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=45 paymentWeight=43 orderStatusWeight=4 deliveryWeight=4 stockLevelWeight=4
// Directory name to create for collecting detailed result data.
// Comment this out to suppress.
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 使用
2.1 测试库准备
创建测试数据库
tpcc
mysql -uroot -p123456
create database tpcc;
exit;
2.2 数据创建
./run/runDatabaseBuild.sh props.mysql
2.3 TPCC测试
./run/runBenchmark.sh props.mysql