sysbench数据库压测工具使用

数据准备

sysbench /usr/local/share/sysbench/oltp_common.lua      --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=Zc1063420481   --tables=10 --table_size=20000000 --threads=100 --max-requests=0 prepare

oltp测试

sysbench ./tests/include/oltp_legacy/oltp.lua --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=Zc1063420481 --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=200000 --threads=10 --time=120 --report-interval=10 run >> /home/test/mysysbench.log

纯读模式

sysbench ./tests/include/oltp_legacy/select.lua --mysql-host=localhost --mysql-port=3306 --mysql-user=root --mysql-password=Zc1063420481 --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=200000 --threads=10 --time=120 --report-interval=10 run >> /home/test/mysysbench.log

sysbenh测试工具命令,根据测试需要调整参数sysbench [options]… [testname] [command]

sysbench --help 查看命令的基本参数

表5-1

选项[options]备注
–test脚本路径 oltp.lua
–mysql-db测试库名称
–mysql-host数据库IP地址
–mysql-port端口号 默认3306
–mysql-user数据库用户名,一般是root
–mysql-password数据库密码

在老版本的sysbench中,可以通过–test参数指定测试的脚本;

而在新版本中,–test参数已经声明为废弃,可以不使用–test,而是直接指定脚本。如下两种结果相同

img

测试项[testname]备注
–oltp-tables-count建表数量
–oltp-table-size每张表的数据量,默认[10000]
–time=N限制的总执行时间,默认为10s
–threads=N需要使用的线程数,默认为1
–report-interval=N指定间隔(秒)报告统计信息,默认为0,禁用
–oltp-test-mode=complex测试模式,默认complex

–oltp-test-mode 运行模式包括:

simple 模式下只测试简单的查询;

nontrx 不仅测试查询,还测试插入更新等,但是不使用事务;

complex 模式下测试最全面,会测试增删改查,而且会使用事务。

备注:如果需要特别测试服务器只读性能,或不使用事务时的性能,可以

选择simple模式或nontrx模式。

命令[command]备注
prepare准备测试数据
run执行测试
cleanup清理数据
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值