文章目录
前言
本文主要介绍使用benchmark工具对数据库进行7*24小时稳定性测试。
一、执行前准备
通常指执行稳定性测试之前需要关注以下几点:
1、根据实际测试环境设计业务模型。
2、检查操作系统core日志记录相关参数是否开启。
二、使用步骤
1.tpcc业务模型
使用benchmark工具,进行稳定测试主要考虑以下几个因素:
1、数据量与并发数
warehouse(数据仓数)和terminals(并发数)配比,可以对每分钟事务数进行限制从而减少数据量的产生。
2、测试环境存储空间
若磁盘空间不够很容易在未达到指定时间,因磁盘写满而退出。
1.1 limitTxnsPerMin
使用benchmarksql工具跑稳定性时,需要限制limitTxnsPerMin(每分钟事务总数限制),防止处理事务太多将磁盘写满。
- 测试吞吐量时,需要将此值设置极大(0),保证不会出现某个终端sleep现象。
- 若terminals数量大于limitTxnsPerMin值,该参数会失效。
假如limitTxnsPerMin参数使用默认300,terminals终端数量设置为150并发:
A=limitTxnsPerMin/terminals=2
“A为int类型,若terminals值大于limitTxnsPerMin,A值必然为0”
benchmarksql工具会记录一个事务的开始时间和结束时间:
假设B=2000毫秒,C=60000(1分钟)/2=30000。
若事务运行时间:B<C,则该事务执行完后,sleep C-B秒后再执行下一个事务;若B>C,则说明事务超过了预期时间,那么马上进行下一个事务;
2 props.pg典型配置
db=postgres
driver=org.postgresql.Driver
conn=jdbc:postgresql://127.0.0.1:54321/benchmarksql#?defaultRowFetchSize=5
user=benchmarksql
password=123456
warehouses=50
loadWorkers=50
terminals=50 //并发数不能过大,否则容易将磁盘写满
//To run specified transactions per terminal- runMins must equal zero
runTxnsPerTerminal=3000 //限制每分钟事务数,存储空间较小需要进行限制
//To run for specified minutes- runTxnsPerTerminal must equal zero
runMins=10080 //执行时间7*24小时
//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

本文详细介绍使用benchmark工具对数据库进行7*24小时稳定性测试的过程。包括执行前准备、使用步骤、结果检查等关键环节,并提供具体配置示例。
最低0.47元/天 解锁文章
2342

被折叠的 条评论
为什么被折叠?



