基于BenchmarkSQL的OceanBase数据库tpcc性能测试
基于BenchmarkSQL的OceanBase数据库tpcc性能测试
- 安装BenchmarkSQL及其依赖
- 安装软件依赖
- 编译BenchmarkSQL
- BenchmarkSQL props文件配置
- 数据库和测试表配置
- BenchmarkSQL压测
- 装载测试数据
- TPC-C压测(固定事务数量)
- TPC-C压测(固定时长)
- 生成测试报告
- 重复测试流程梳理
安装BenchmarkSQL及其依赖
软件包 | 作用 |
---|---|
benchmarksql-5.0.zip | tpcc性能测试 |
R-3.6.3.tar.gz | 生成压测报告 |
mysql-connector-java-5.1.47 | MySQL连接驱动 |
操作系统:
[root@localhost ~]# nkvers
############## Kylin Linux Version #################
Release:
Kylin Linux Advanced Server release V10 (Sword)Kernel:
4.19.90-25.16.v2101.ky10.x86_64Build:
Kylin Linux Advanced Server
release V10 (SP2) /(Sword)-x86_64-Build09/20210524
#################################################
安装软件依赖
检查JDK版本是否为1.8:
java -version
安装依赖软件包:
yum install -y glibc-common
yum install gcc glibc-headers gcc-c++ gcc-gfortran readline-devel libXt-devel pcre-devel libcurl libcurl-devel -y
yum install ncurses ncurses-devel autoconf automake zlib zlib-devel bzip2 bzip2-devel xz-devel -yyum install -y numactl
报错信息:
[FAILED] glibc-common-2.28-49.p16.ky10.x86_64.rpm: No more mirrors to try - All mirrors were already tried without success The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'yum clean packages'.
Error: Error downloading packages:Cannot download Packages/glibc-common-2.28-49.p16.ky10.x86_64.rpm: All mirrors were tried#解决办法
yum install -y glibc-common
编译安装R语言:
yum install pango-devel pango libpng-devel cairo cairo-devel -ytar -zxf R-3.6.3.tar.gz -C /opt
cd /opt/R-3.6.3
./configure
make && make install
检查安装情况:
[root@primarydb benchmarksql]# R --version
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
安装ant工具:
yum install -y ant
ant -version
ant命令报错:
ant -version#报错信息
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-1.h5.ky10.x86_64/lib/tools.jar#解决办法
yum clean packages
yum install java-1.8.0-openjdk-devel -y
编译BenchmarkSQL
解压安装包:
[root@primarydb ~]# unzip -qo benchmarksql-5.0.zip -d /opt
[root@primarydb ~]# cd /opt/benchmarksql-5.0/
- 修改
benchmarksql-5.0/src/client/jTPCC.java
文件,增加OceanBase数据库相关内容:
if (iDB.equals("firebird"))dbType = DB_FIREBIRD;else if (iDB.equals("oracle"))dbType = DB_ORACLE;else if (iDB.equals("postgres"))dbType = DB_POSTGRES;else if (iDB.equals("oceanbase"))dbType = DB_OCEANBASE;else{log.error("unknown database type '" + iDB + "'");return;}
- 修改
benchmarksql-5.0/src/client/jTPCCConfig.java
文件,增加OceanBase数据库类型:
public final static int
DB_UNKNOWN = 0,
DB_FIREBIRD = 1,
DB_ORACLE = 2,
DB_POSTGRES = 3,
DB_OCEANBASE = 4;
- 修改
benchmarksql-5.0/src/client/jTPCCConnection.java
文件,在SQL子查询增加AS L别名。
default:stmtStockLevelSelectLow = dbConn.prepareStatement("SELECT count(*) AS low_stock FROM (" +" SELECT s_w_id, s_i_id, s_quantity " +" FROM bmsql_stock " +" WHERE s_w_id = ? AND s_quantity < ? AND s_i_id IN (" +" SELECT ol_i_id " +" FROM bmsql_district " +" JOIN bmsql_order_line ON ol_w_id = d_w_id " +" AND ol_d_id = d_id " +" AND ol_o_id >= d_next_o_id - 20 " +" AND ol_o_id < d_next_o_id " +" WHERE d_w_id = ? AND d_id = ? " +" ) " +" )AS L");break;
- 使用ant编译BenchmarkSQL:
[root@zcs024kvm benchmarksql-5.0]# ant
Buildfile: /opt/benchmarksql-5.0/build.xmlinit:[mkdir] Created dir: /opt/benchmarksql-5.0/buildcompile:[javac] Compiling 11 source files to /opt/benchmarksql-5.0/builddist:[mkdir] Created dir: /opt/benchmarksql-5.0/dist