使用sysbench做压测

sysbench是一个多线程的基准测试工具,适用于跨平台的CPU、内存、线程和磁盘I/O性能测试。本文介绍了sysbench的基本语法,并详细阐述了如何进行CPU、内存、线程和IO的测试操作,包括顺序读写和随机读写的场景。
摘要由CSDN通过智能技术生成

sysbench压测工具

介绍:

sysbench是一个模块化、跨平台、多线程基准测试工具,主要用于测试不同系统参数下的数据库负载情况,可以用来进行CPU、内存、磁盘I/O、线程、数据库的性能测试。sysbench主要用于以下性能测试:

file I/O performance (文件I / O性能)
scheduler performance (调度性能)
memory allocation and transfer speed (内存分配和传输速度)
POSIX threads implementation performance (POSIX线程执行绩效)
database server performance (OLTP benchmark) (数据库服务器性能)

一般语法:

[root@andriy ~]# sysbench 
Missing required command argument.
Usage: #使用方法
  sysbench [general-options]... --test=<test-name> [test-options]... command

General options: #通用选项
  --num-threads=N            number of threads to use [1] #创建测试线程的数目。默认为1.
  --max-requests=N           limit for total number of requests [10000] #请求的最大数目。默认为10000,0代表不限制。
  --max-time=N               limit for total execution time in seconds [0] #最大执行时间,单位是s。默认是0,不限制。
  --forced-shutdown=STRING   amount of time to wait after --max-time before forcing shutdown [off] #超过max-time强制中断。默认是off。
  --thread-stack-size=SIZE   size of stack per thread [32K] #每个线程的堆栈大小。默认是32K。
  --init-rng=[on|off]        initialize random number generator [off] #在测试开始时是否初始化随机数发生器。默认是off。
  --test=STRING              test to run #指定测试项目名称。
  --debug=[on|off]           print more debugging info [off] #是否显示更多的调试信息。默认是off。
  --validate=[on|off]        perform validation checks where possible [off] #在可能情况下执行验证检查。默认是off。
  --help=[on|off]            print help and exit #帮助信息。
  --version=[on|off]         print version and exit #版本信息。

Compiled-in tests: #测试项目
  fileio - File I/O test #IO
  cpu - CPU performance test #CPU
  memory - Memory functions speed test #内存
  threads - Threads subsystem performance test #线程
  mutex - Mutex performance test #互斥性能测试
  oltp - OLTP test # 数据库,事务处理

Commands: prepare:测试前准备工作; run:正式测试 cleanup:测试后删掉测试数据 help version

See 'sysbench --test=<name> help' for a list of options for each test. #查看每个测试项目的更多选项列表
root@db2:~# sysbench --test=oltp help
sysbench 0.4.12:  multi-threaded system evaluation benchmark

oltp options:
  --oltp-test-mode=STRING    执行模式{simple,complex(advanced transactional),nontrx(non-transactional),sp}。默认是complex
  --oltp-reconnect-mode=STRING 重新连接模式{session(不使用重新连接。每个线程断开只在测试结束),transaction(在每次事务结束后重新连接),query(在每个SQL语句执行完重新连接),random(对于每个事务随机选择以上重新连接模式)}。默认是session
  --oltp-sp-name=STRING   存储过程的名称。默认为空
  --oltp-read-only=[on|off]  只读模式。Update,delete,insert语句不可执行。默认是off
  --oltp-skip-trx=[on|off]   省略begin/commit语句。默认是off
  --oltp-range-size=N      查询范围。默认是100
  --oltp-point-selects=N          number of point selects [10]
  --oltp-simple-ranges=N          number of simple ranges [1]
  --oltp-sum-ranges=N             number of sum ranges [1]
  --oltp-order-ranges=N           number of ordered ranges [1]
  --oltp-distinct-ranges=N        number of distinct ranges [1]
  --oltp-index-updates=N          number of index update [1]
  --oltp-non-index-updates=N      number of non-index updates [1]
  --oltp-nontrx-mode=STRING   查询类型对于非事务执行模式{select, update_key, u
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值