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