BenchMarkSQL 5.0测试GBase 8s
介绍
BenchmarkSQL5是一款经典的开源数据库测试工具,内嵌了TPCC测试脚本,可以对PostgreSQL、Firebird以及Oracle等数据库直接进行测试。由于其未对其它数据库(如GBase 8s)进行支持,需要对源码进行少量的修改,以增加对其它数据库的支持。它通过JDBC测试OLTP(联机事务处理, Online Transaction Processing)的TPC-C。
配置
1,获取安装包。
下载benchmarksql-5.0.tgz安装包(经修改,增加了对GBase 8s的支持)。
BenchmarkSQL需要ant编译环境,通过yum安装,将自动安装ant及其依赖包
1 | [root@a01 ~]# yum -y install ant |
2,将benchmarksql-5.0.tgz压缩包上传至客户端服务器用户HOME目录下。
3,进入上传的目录并执行解压命令。
1 | [root@a01 ~]# tar -zxvf benchmarksql-5.0.tgz |
将生成benchmarksql-5.0目录
4,编译BenchMarkSQL 5.0
进行benchmarksql-5.0目录,执行ant进行编译
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [root@a01 ~]# cd benchmarksql-5.0 [root@a01 benchmarksql-5.0]# ant Buildfile: /root/benchmarksql-5.0/build.xml init: [mkdir] Created dir: /root/benchmarksql-5.0/build compile: [javac] Compiling 11 source files to /root/benchmarksql-5.0/build dist: [jar] Building jar: /root/benchmarksql-5.0/dist/BenchmarkSQL-5.0.jar BUILD SUCCESSFUL Total time: 2 seconds |
生成BenchmarkSQL-5.0.jar
测试GBase 8s
1,使用gbasedbt在已部署好的GBase 8s数据库创建数据库(bm5)。
1 | create database bm5 in datadbs01 with log; |
2,修改配置文件。
根据实际情况修改配置文件进入Benchmarksql的run目录,按实际情况修改配置文件。
1 2 3 | [root@a01 benchmarksql-5.0]# cd run/ [root@a01 run]# cp props.gbase props.3.0.0_1 [root@a01 run]# vi props.3.0.0_1 |
修改下面部分,其余部分可使用默认值,通常不用修改。
参数 | 值 | 说明 |
---|---|---|
db | gbase | 指定数据库类型(修改后增加的数据库类型) |
driver | com.gbasedbt.jdbc.Driver | 数据库的驱动类名称 |
conn | jdbc:gbasedbt-sqli://127.0.0.1:9088/bm5:GBASEDBTSERVER=gbase01; IFX_LOCK_MODE_WAIT=60; IFX_ISOLATION_LEVEL=1U; OPTOFC=1; | 连接字符串 特别注意: IFX_ISOLATION_LEVEL后需要U标识 |
user | gbasedbt | 用户名 |
password | GBase123 | 用户密码 |
warehouses | 10 | 初始化加载数据时,需要创建多少仓库的数据。每仓库约80MB数据 |
loadWorkers | 4 | 表示加载数据时,开启加载数据的进程数。对于GBase 8s需要谨慎设置该参数,与逻辑日志量相关 |
terminals | 20 | 终端数量,指同时有多少终端并发执行,表示并发程度。 |
runTxnsPerTerminal | 0 | 每分钟每个终端执行的事务数。 |
runMins | 1 | 执行多少分钟。 |
limitTnxsPermin | 0 | 限制每分钟执行的事务总数。0表示不限制 |
terminalWarehouseFixed | true | 用于指定终端和仓库的绑定模式,设置为true时可以运行4.x兼容模式,意思为每个终端都有一个固定的仓库。设置为false时可以均匀的使用数据库整体配置。 |
特别注意:
runMins和runTxnsPerTerminal这两个参数指定了两种运行方式,前者是按照指定运行时间执行,以时间为标准;后者以指定每个终端的事务数为标准执行。两者不能同时生效,必须有一个设定为0。
3,初始化数据。
在run目录下执行命令给文件赋予可执行权限。
1 | [root@a01 run]# chmod +x *.sh |
注意:
如果已经赋予相关权限,不用重复操作。
4,加载数据。
1 | [root@a01 run]# ./runDatabaseBuild.sh props.3.0.0_1 |
创建并初始化表—共9张表(warehouse, Stock, Item, Order-Line, New-Order, History, District, Customer,Order),外加一个配置表。
同时会创建相应的索引、主外键参考。
5,运行benchmarksql程序。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | [root@a01 run]# ./runBenchmark.sh props.3.0.0_1 10:43:15,284 [main] INFO jTPCC : Term-00, 10:43:15,291 [main] INFO jTPCC : Term-00, +-------------------------------------------------------------+ 10:43:15,291 [main] INFO jTPCC : Term-00, BenchmarkSQL v5.0 10:43:15,291 [main] INFO jTPCC : Term-00, +-------------------------------------------------------------+ 10:43:15,291 [main] INFO jTPCC : Term-00, (c) 2003, Raul Barbosa 10:43:15,291 [main] INFO jTPCC : Term-00, (c) 2004-2016, Denis Lussier 10:43:15,293 [main] INFO jTPCC : Term-00, (c) 2016, Jan Wieck 10:43:15,293 [main] INFO jTPCC : Term-00, +-------------------------------------------------------------+ 10:43:15,293 [main] INFO jTPCC : Term-00, 10:43:15,293 [main] INFO jTPCC : Term-00, db=gbase 10:43:15,293 [main] INFO jTPCC : Term-00, driver=com.gbasedbt.jdbc.Driver 10:43:15,293 [main] INFO jTPCC : Term-00, conn=jdbc:gbasedbt-sqli://127.0.0.1:9088/bm5:GBASEDBTSERVER=gbase01;IFX_LOCK_MODE_WAIT=60;IFX_ISOLATION_LEVEL=1U;OPTOFC=1;DB_LOCALE=en_US.819;CLIENT_LOCALE=en_US.819 10:43:15,293 [main] INFO jTPCC : Term-00, user=gbasedbt 10:43:15,294 [main] INFO jTPCC : Term-00, 10:43:15,294 [main] INFO jTPCC : Term-00, warehouses=4 10:43:15,294 [main] INFO jTPCC : Term-00, terminals=8 10:43:15,296 [main] INFO jTPCC : Term-00, runMins=1 10:43:15,296 [main] INFO jTPCC : Term-00, limitTxnsPerMin=0 10:43:15,296 [main] INFO jTPCC : Term-00, terminalWarehouseFixed=true 10:43:15,296 [main] INFO jTPCC : Term-00, 10:43:15,296 [main] INFO jTPCC : Term-00, newOrderWeight=45 10:43:15,296 [main] INFO jTPCC : Term-00, paymentWeight=43 10:43:15,296 [main] INFO jTPCC : Term-00, orderStatusWeight=4 10:43:15,297 [main] INFO jTPCC : Term-00, deliveryWeight=4 10:43:15,297 [main] INFO jTPCC : Term-00, stockLevelWeight=4 10:43:15,297 [main] INFO jTPCC : Term-00, 10:43:15,297 [main] INFO jTPCC : Term-00, resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS 10:43:15,297 [main] INFO jTPCC : Term-00, osCollectorScript=./misc/os_collector_linux.py 10:43:15,297 [main] INFO jTPCC : Term-00, 10:43:15,318 [main] INFO jTPCC : Term-00, copied props.3.0.0_1 to my_result_2020-09-28_104315/run.properties 10:43:15,318 [main] INFO jTPCC : Term-00, created my_result_2020-09-28_104315/data/runInfo.csv for runID 1 10:43:15,318 [main] INFO jTPCC : Term-00, writing per transaction results to my_result_2020-09-28_104315/data/result.csv 10:43:15,319 [main] INFO jTPCC : Term-00, osCollectorScript=./misc/os_collector_linux.py 10:43:15,319 [main] INFO jTPCC : Term-00, osCollectorInterval=1 10:43:15,320 [main] INFO jTPCC : Term-00, osCollectorSSHAddr=null 10:43:15,320 [main] INFO jTPCC : Term-00, osCollectorDevices=net_eth0 blk_sda 10:43:15,467 [main] INFO jTPCC : Term-00, 10:43:15,699 [main] INFO jTPCC : Term-00, C value for C_LAST during load: 83 10:43:15,699 [main] INFO jTPCC : Term-00, C value for C_LAST this run: 11 10:43:15,699 [main] INFO jTPCC : Term-00, Traceback (most recent call last):: 0.00 Current tpmTOTAL: 0 Memory Usage: 5MB / 29MB File "<stdin>", line 299, in <module> File "<stdin>", line 86, in main File "<stdin>", line 226, in initBlockDevice IOError: [Errno 2] No such file or directory: '/sys/block/sda/stat' 10:43:16,009 [Thread-0] ERROR OSCollector$CollectData : OSCollector, unexpected EOF while reading from external helper process Term-00, Running Average tpmTOTAL: 17619.83 Current tpmTO10:44:15,988 [Thread-7] INFO jTPCC : Term-00, 10:44:15,988 [Thread-7] INFO jTPCC : Term-00, 10:44:15,988 [Thread-7] INFO jTPCC : Term-00, Measured tpmC (NewOrders) = 7952.5 10:44:15,988 [Thread-7] INFO jTPCC : Term-00, Measured tpmTOTAL = 17618.61 10:44:15,988 [Thread-7] INFO jTPCC : Term-00, Session Start = 2020-09-28 10:43:15 10:44:15,988 [Thread-7] INFO jTPCC : Term-00, Session End = 2020-09-28 10:44:15 10:44:15,988 [Thread-7] INFO jTPCC : Term-00, Transaction Count = 17632 |
执行结束后,取tpmC和tpmTOTAL作为测试指标。
6,删除数据库和数据。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [root@a01 run]# ./runDatabaseDestroy.sh props.3.0.0_1 # ------------------------------------------------------------ # Loading SQL file ./sql.common/tableDrops.sql # ------------------------------------------------------------ drop table bmsql_config; drop table bmsql_new_order; drop table bmsql_order_line; drop table bmsql_oorder; drop table bmsql_history; drop table bmsql_customer; drop table bmsql_stock; drop table bmsql_item; drop table bmsql_district; drop table bmsql_warehouse; drop sequence bmsql_hist_id_seq; |
[Thread-0] ERROR OSCollector$CollectData : OSCollector, unexpected EOF while reading from external helper process
[main] ERROR jTPCC : Term-00, For input string: "0"