一、准备软件包
jdk: 地址:https://pan.baidu.com/s/1sbgLPROfd9e_valSfv0YAQ 提取码:4qps
benchmark:地址:https://pan.baidu.com/s/1nAHER-BXpgG0LUnR8NbT7Q 提取码:xcbu
二、安装
1、jdk安装:
1.1 解压安装到34机器的/data/tbase/jdk目录下
1.2 配置环境变量如下:
[tbase@VM_0_37_centos jdk]$ cat /data/tbase/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
export JAVA_HOME=/data/tbase/jdk
export JDK_PATH=${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin
export JDK_CLASSPATH=${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib
export PATH=${JDK_PATH}:${PATH}
export CLASSPATH=.:${JDK_CLASSPATH}:${CLASSPATH}
2、benchmark安装:
2.1 上传benchmarksql-for-tbase-5.0.tar.gz到/data/tbase/tpcc目录下并解压
tar -zxfbenchmarksql-for-tbase-5.0.tar.gz
rm -rf benchmarksql-for-tbase-5.0.tar.gz
2.2 配置props.pg参数
cd /data/tbase/tpcc/benchmarksql-5.0/run
vim props.pg,修改如下:
//数据库连接参数
db=postgres
driver=org.postgresql.Driver
conn=jdbc:postgresql://20.4.74.35:11345,20.4.74.39:11300/benchmarksql?loadBalanceHosts=true&targetServerType=master
user=benchmarksql
password=benchmarksql
//生成的仓库
warehouses=200
//生成仓库的并发进程
loadWorkers=25
//测试时并发数
terminals=100
//To run specified transactions per terminal- runMins must equal zero
runTxnsPerTerminal=0
//To run for specified minutes- runTxnsPerTerminal must equal zero
//测试时长
runMins=20
//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
三、测试
3.1 建立测试库
[tbase@VM_0_37_centos run]$ psql -h 20.4.74.35 -p 11345 -U tbase -d postgres
psql (PostgreSQL 10.0 TBase V5)
Type "help" for help.
postgres=# create database benchmarksql;
CREATE DATABASE
postgres=# create user benchmarksql with password 'benchmarksql';
CREATE ROLE
postgres=# alter database benchmarksql owner to benchmarksql;
ALTER DATABASE
3.2 导入表和数据
[tbase@VM_0_37_centos run]$ cd /data/tbase/tpcc/benchmarksql-5.0/run
[tbase@VM_0_37_centos run]$ ./runDatabaseBuild.sh props.pg
3.3 进行测试
[tbase@VM_0_37_centos run]$ cd /data/tbase/tpcc/benchmarksql-5.0/run
[tbase@VM_0_37_centos run]$ ./runBenchmark.sh props.pg
修改“2.2 配置props.pg参数”章节中的文件,分别测试100并发、200并发和300并发三个场景。
四、结果解读
仓库数量 |
并发数 |
测试时长(分钟) |
节点日志同步级别 |
各客户端QPS(分钟) |
|
200 |
100 |
20 |
异步模式 |
tpmC (NewOrders) = 127005.38 |
|
200 |
200 |
20 |
异步模式 |
tpmC
(NewOrders) = 195664.13 |
|
200 |
300 |
20 |
异步模式 |
tpmC
(NewOrders) =212892.69 |