sysbench--基础--03--命令

sysbench–基础–03–命令


1、语法

[root@zhoufei ~]# sysbench   --help
Usage:
  sysbench [options]... [testname] [command]

Commands implemented by most tests: prepare run cleanup help

General options:
  --threads=N                     number of threads to use [1]
  --events=N                      limit for total number of events [0]
  --time=N                        limit for total execution time in seconds [10]
  --forced-shutdown=STRING        number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off]
  --thread-stack-size=SIZE        size of stack per thread [64K]
  --rate=N                        average transactions rate. 0 for unlimited rate [0]
  --report-interval=N             periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]
  --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
  --debug[=on|off]                print more debugging info [off]
  --validate[=on|off]             perform validation checks where possible [off]
  --help[=on|off]                 print help and exit [off]
  --version[=on|off]              print version and exit [off]
  --config-file=FILENAME          File containing command line options
  --tx-rate=N                     deprecated alias for --rate [0]
  --max-requests=N                deprecated alias for --events [0]
  --max-time=N                    deprecated alias for --time [0]
  --num-threads=N                 deprecated alias for --threads [1]

Pseudo-Random Numbers Generator options:
  --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special]
  --rand-spec-iter=N number of iterations used for numbers generation [12]
  --rand-spec-pct=N  percentage of values to be treated as 'special' (for special distribution) [1]
  --rand-spec-res=N  percentage of 'special' values to use (for special distribution) [75]
  --rand-seed=N      seed for random number generator. When 0, the current time is used as a RNG seed. [0]
  --rand-pareto-h=N  parameter h for pareto distribution [0.2]

Log options:
  --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]

  --percentile=N       percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]
  --histogram[=on|off] print latency histogram in report [off]

General database options:

  --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers) [mysql]
  --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
  --db-debug[=on|off] print database-specific debug information [off]


Compiled-in database drivers:
  mysql - MySQL driver
  pgsql - PostgreSQL driver

mysql options:
  --mysql-host=[LIST,...]          MySQL server host [localhost]
  --mysql-port=[LIST,...]          MySQL server port [3306]
  --mysql-socket=[LIST,...]        MySQL socket
  --mysql-user=STRING              MySQL user [sbtest]
  --mysql-password=STRING          MySQL password []
  --mysql-db=STRING                MySQL database name [sbtest]
  --mysql-ssl[=on|off]             use SSL connections, if available in the client library [off]
  --mysql-ssl-cipher=STRING        use specific cipher for SSL connections []
  --mysql-compression[=on|off]     use compression, if available in the client library [off]
  --mysql-debug[=on|off]           trace all client library calls [off]
  --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205]
  --mysql-dry-run[=on|off]         Dry run, pretend that all MySQL client API calls are successful without executing them [off]

pgsql options:
  --pgsql-host=STRING     PostgreSQL server host [localhost]
  --pgsql-port=N          PostgreSQL server port [5432]
  --pgsql-user=STRING     PostgreSQL user [sbtest]
  --pgsql-password=STRING PostgreSQL password []
  --pgsql-db=STRING       PostgreSQL database name [sbtest]

Compiled-in tests:
  fileio - File I/O test
  cpu - CPU performance test
  memory - Memory functions speed test
  threads - Threads subsystem performance test
  mutex - Mutex performance test

See 'sysbench <testname> help' for a list of options for each test.

2、testname

指定测试项目名称

2.1、可以使用的项目名称

fileio # IO 
cpu -  # CPU        
memory # 内存
threads # 线程
mutex # 互斥性能
oltp # 数据库,事务处理

2.2、查看测试项目帮助命令

# IO
sysbench  --test=fileio help
# CPU
sysbench  --test=cpu help
# 内存
sysbench  --test=memory help
# 线程
sysbench  --test=threads help
# 互斥性能
sysbench  --test=mutex help
# 事务处理
sysbench --test=oltp help

2.3、案例

 
#  直接指定脚本
sysbench ./tests/include/oltp_legacy/oltp.lua
#  使用项目名称
sysbench fileio

3、command

3.1、prepare

测试前准备工作,例如为fileis测试在磁盘上创建必要的文件,为OLTP测试准备测试数据

3.2、run

执行完整的测试,必须指定–-test选项

3.3、cleanup

测试结束后删除数据

4、options

4.1、通用参数

4.1.1、–version=[on|off]

版本信息。

4.1.2、–help=[on|off]

帮助信息。

4.1.3、–max-time=N

  1. 最大执行时间
  2. 单位是s
  3. 默认:0,不限制。

4.1.4、–forced-shutdown=STRING

  1. 超过 max-time 的时候会强制中断。
  2. 默认:off。

4.1.5、–thread-stack-size=SIZE

  1. 每个线程的堆栈大小
  2. 默认:32K。

4.1.6、–init-rng=[on|off]

  1. 在测试开始时是否初始化随机数发生器
  2. 默认:off。

4.1.7、–debug=[on|off]

  1. 是否显示更多的调试信息。
  2. 默认:off。

4.1.8、–validate=[on|off]

  1. 在可能情况下执行验证检查
  2. 默认:off。

4.1.9、–threads

  1. 创建测试线程的数
  2. 默认:1

4.1.10、–max-requests=N

  1. 请求的最大数目
  2. 默认:10000
  3. 0:代表不限制。

4.1.11、––tx-rate=N

sysbench尝试向数据库发送的事务数tps。

4.1.12、––report-interval=N

  1. 表示N秒输出一次测试进度报告
  2. 默认: 0,表示关闭测试进度报告输出,仅输出最终的报告结果

4.1.13、–rand-type=STRING

  1. 表示随机类型的模式
  2. 共有4种模式
    1. uniform(固定)
    2. gaussian(高斯)
    3. special(特定)
    4. pareto(帕雷特)
  3. 默认值为:special。

4.1.14、–rand-spec-iter

  1. 用于生成数字的迭代次数
  2. 默认:12
    number of iterations used for numbers generation [12]

4.1.15、–rand-spec-pct=N

  1. 对于"special"随机模式中指定值的比例
  2. 默认值为75。

4.1.16、–rand-seed=N

  1. 随机数生成器的种子
  2. 忽略0

4.1.17、–rand-pareto-h=N

parameter h for pareto distibution [0.2]

4.1.18、–config-file

sysbench配置文件路径。

4.2、日志参数

4.2.1、–verbosity=N

  1. 信息输出级别
  2. 5为debug信息
  3. 0为errpr信息
  4. 默认:3。

4.2.2、–percentile=N

  1. 查询相应时间采样的百分比
  2. 默认值:95%。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值