上一篇我们分享了测试方法,本篇我们将发起测试及测试结果。

背景

本文提供openGauss使用BenchmarkSQL进行性能测试的方法和测试数据报告。

BenchmarkSQL,一个JDBC基准测试工具,内嵌了TPC-C测试脚本,支持很多数据库,如PostgreSQL、Oracle和Mysql等。

TPC-C是专门针对联机交易处理系统(OLTP系统)的规范,一般情况下我们也把这类系统称为业务处理系统。几乎所有在OLTP市场提供软硬平台的国外主流厂商都发布了相应的TPC-C测试结果,随着计算机技术的不断发展,这些测试结果也在不断刷新。

六、BenchmarkSQL主机发起测试

1. 导入测试数据

cd /root/soft/benchmarksql-5.0/run

[root@localhost run]# ./runDatabaseBuild.sh props.openGauss ## 执行前,请务必将props.openGauss文件中的所有注释和多余空格删除,否则可能报错

特别说明,上一步脚本执行后,请检查库表是否创建、数据是否加载成功,如过未成功,请查看.sh脚本及执行日志进行判断,如果有必要则请手工执行加载脚本,如下:

[root@localhost run]# ./runLoader.sh props.openGauss

2. 运行TPCC测试

[root@localhost run]# ./runBenchmark.sh props.openGauss

19:04:56,061 [main] INFO jTPCC : Term-00,

19:04:56,070 [main] INFO jTPCC : Term-00, +-------------------------------------------------------------+

19:04:56,070 [main] INFO jTPCC : Term-00, BenchmarkSQL v5.0

19:04:56,070 [main] INFO jTPCC : Term-00, +-------------------------------------------------------------+

19:04:56,070 [main] INFO jTPCC : Term-00, (c) 2003, Raul Barbosa

19:04:56,070 [main] INFO jTPCC : Term-00, (c) 2004-2016, Denis Lussier

19:04:56,072 [main] INFO jTPCC : Term-00, (c) 2016, Jan Wieck

19:04:56,072 [main] INFO jTPCC : Term-00, +-------------------------------------------------------------+

19:04:56,072 [main] INFO jTPCC : Term-00,

19:04:56,072 [main] INFO jTPCC : Term-00, db=postgres

19:04:56,072 [main] INFO jTPCC : Term-00, driver=org.postgresql.Driver

19:04:56,072 [main] INFO jTPCC : Term-00, conn=jdbc:postgresql://192.168.52.3:26000/tpcc

19:04:56,072 [main] INFO jTPCC : Term-00, user=benchmarksql

19:04:56,072 [main] INFO jTPCC : Term-00,

19:04:56,072 [main] INFO jTPCC : Term-00, warehouses=2

19:04:56,072 [main] INFO jTPCC : Term-00, terminals=2

19:04:56,073 [main] INFO jTPCC : Term-00, runMins=5

19:04:56,073 [main] INFO jTPCC : Term-00, limitTxnsPerMin=0

19:04:56,073 [main] INFO jTPCC : Term-00, terminalWarehouseFixed=false

19:04:56,073 [main] INFO jTPCC : Term-00,

19:04:56,073 [main] INFO jTPCC : Term-00, newOrderWeight=45

19:04:56,073 [main] INFO jTPCC : Term-00, paymentWeight=43

19:04:56,074 [main] INFO jTPCC : Term-00, orderStatusWeight=4

19:04:56,074 [main] INFO jTPCC : Term-00, deliveryWeight=4

19:04:56,074 [main] INFO jTPCC : Term-00, stockLevelWeight=4

19:04:56,074 [main] INFO jTPCC : Term-00,

19:04:56,074 [main] INFO jTPCC : Term-00, resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS

19:04:56,074 [main] INFO jTPCC : Term-00, osCollectorScript=./misc/os_collector_linux.py

19:04:56,074 [main] INFO jTPCC : Term-00,

19:04:56,089 [main] INFO jTPCC : Term-00, copied props.openGauss to my_result_2024-02-28_190456/run.properties

19:04:56,089 [main] INFO jTPCC : Term-00, created my_result_2024-02-28_190456/data/runInfo.csv for runID 34

19:04:56,089 [main] INFO jTPCC : Term-00, writing per transaction results to my_result_2024-02-28_190456/data/result.csv

19:04:56,090 [main] INFO jTPCC : Term-00, osCollectorScript=./misc/os_collector_linux.py

19:04:56,090 [main] INFO jTPCC : Term-00, osCollectorInterval=1

19:04:56,090 [main] INFO jTPCC : Term-00, osCollectorSSHAddr=root@192.168.52.3

19:04:56,090 [main] INFO jTPCC : Term-00, osCollectorDevices=net_ens33 blk_sda

19:04:56,169 [main] INFO jTPCC : Term-00,

二月 28, 2024 7:04:56 下午 org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl

信息: [93b50383-dbd7-400a-a99d-86f4ba0902a0] Try to connect. IP: 192.168.52.3:26000

二月 28, 2024 7:05:06 下午 org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl

信息: [192.168.52.4:58872/192.168.52.3:26000] Connection is established. ID: 93b50383-dbd7-400a-a99d-86f4ba0902a0

二月 28, 2024 7:05:06 下午 org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl

信息: Connect complete. ID: 93b50383-dbd7-400a-a99d-86f4ba0902a0

19:05:06,307 [main] INFO jTPCC : Term-00, C value for C_LAST during load: 173

19:05:06,307 [main] INFO jTPCC : Term-00, C value for C_LAST this run: 246

19:05:06,307 [main] INFO jTPCC : Term-00, 二月 28, 2024 7:05:06 下午 org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImplMB

信息: [f43d5730-4a2d-4679-bf40-8ca74c9a2498] Try to connect. IP: 192.168.52.3:26000

二月 28, 2024 7:05:16 下午 org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl

信息: [192.168.52.4:58874/192.168.52.3:26000] Connection is established. ID: f43d5730-4a2d-4679-bf40-8ca74c9a2498

二月 28, 2024 7:05:16 下午 org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl

信息: Connect complete. ID: f43d5730-4a2d-4679-bf40-8ca74c9a2498

二月 28, 2024 7:05:16 下午 org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl

信息: [204511eb-81ef-4c16-a0ab-9f64a4b2fa55] Try to connect. IP: 192.168.52.3:26000

二月 28, 2024 7:05:26 下午 org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl

信息: [192.168.52.4:58876/192.168.52.3:26000] Connection is established. ID: 204511eTerm-00, Running Average tpmTOTAL: 7005.81 19:10:26,411 [Thread-2] INFO jTPCC : Term-00, / 29MB 19:10:26,412 [Thread-2] INFO jTPCC : Term-00, 19:10:26,412 [Thread-2] INFO jTPCC : Term-00, Measured tpmC (NewOrders) = 3160.65

19:10:26,413 [Thread-2] INFO jTPCC : Term-00, Measured tpmTOTAL = 7005.82

19:10:26,413 [Thread-2] INFO jTPCC : Term-00, Session Start = 2024-02-28 19:05:26

19:10:26,413 [Thread-2] INFO jTPCC : Term-00, Session End = 2024-02-28 19:10:26

19:10:26,413 [Thread-2] INFO jTPCC : Term-00, Transaction Count = 35032

说明:执行前,请务必将props.openGauss.1000w文件的所有注释和多余空格删除,否则可能报错。 terminals参数设置有大小范围要求,太大会报错:ERROR  jTPCC : Term-00, Invalid number of terminals!y。

重跑:./runDatabaseDestroy.sh props.opengauss  //清理数据。或将5.3中的备份恢复。

七、生成报告查看测试结果

1. 生成报告

测试结束后,run目录下会生成一个新目录:my_result_%tY-%tm-%td_%tH%tM%tS。使用 generateReport.sh脚本创建具有图形的 HTML 文件:

[root@localhost run]# ./generateReport.sh my_result_2024-02-28_190456/

Generating my_result_2024-02-28_190456//tpm_nopm.png ... OK

Generating my_result_2024-02-28_190456//latency.png ... OK

Generating my_result_2024-02-28_190456//cpu_utilization.png ... OK

Generating my_result_2024-02-28_190456//dirty_buffers.png ... OK

Generating my_result_2024-02-28_190456//blk_sda_iops.png ... OK

Generating my_result_2024-02-28_190456//blk_sda_kbps.png ... OK

Generating my_result_2024-02-28_190456//net_ens33_iops.png ... OK

Generating my_result_2024-02-28_190456//net_ens33_kbps.png ... OK

Generating my_result_2024-02-28_190456//report.html ... OK

随后会在my_result_* 目录下生成一个html文件和数张图片,下载到本地,在浏览器中打开report.html,可以看到tpmc的曲线和系统硬件监控信息。

2. html报告查看

八、关于BenchmarkSQL

1. BenchmarkSQL的基本原理

 我们来了解BenchmarkSQL的基本原理。BenchmarkSQL基于Java开发,使用JDBC(Java Database Connectivity)连接数据库。它可以模拟多个用户同时对数据库执行事务操作,比如插入、查询、更新和删除数据,以及并发访问数据库的能力。通过模拟真实的数据库负载,BenchmarkSQL可以测试数据库在高并发情况下的性能表现。

2.TPCC

 TPC(Transaction Processing Council)-C是一个在线事务处理基准 TPC基准C于1992年7月获得批准,是联机事务处理(OLTP)基准,具有多种事务类型、更复杂的数据库和整体执行结构。TPC-C涉及5个不同类型和复杂性的并发事务的混合,这些事务要么在线执行,要么排队延迟执行。目标数据库由九种类型的表组成,具有大范围的记录和数量大小。TPC-C的度量单位是每分钟事务数(tpmC)。虽然基准描述的是批发供应商的活动,但TPC-C并不局限于任何特定业务部门的活动,而是代表任何必须管理、销售或分销产品或服务的行业。

3.BenchmarkSQL

BenchmarkSQL是用Java语言实现的,使用JDBC对SQL数据库进行压力测试。整个体系结构是一系列数据结构、队列和线程组,用于处理模拟终端、用户和应用程序线程。

它的体系结构允许BenchmarkSQL驱动多达数千个仓库的TPC-C配置(称为缩放因子),而不会压倒测试驱动程序本身的作业调度器。然而,它能够在不牺牲TPC-C中最重要的测量之一的情况下做到这一点,即终端用户体验到的终端响应时间。

本篇就分享到这里了,欢迎小伙伴们交流~

相关阅读

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。