基于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