MySQL/Mariadb基准测试工具-sysbench使用1

本文详细介绍了sysbench的使用,包括sysbench的功能、帮助文档解读及在不同场景下的测试,如CPU、线程、互斥锁、内存和文件IO性能测试。在CPU测试中,通过调整参数观察性能;线程测试评估调度器性能;内存测试关注连续读写;文件IO测试则展示了读写速度和延时。
摘要由CSDN通过智能技术生成

前两次说到了sysbench的安装,从这次开始说sysbench的使用。包括sysbench能干什么和除数据库之外的测试。

1.sysbench能干什么

sysbench是一个基于LunJIT的脚本化多线程基准测试工具。过是一个多线程基准测试工具脚本基于LuaJIT。它最常用于数据库基准测试,但也可以用于创建不涉及数据库服务器的任意复杂工作。
sysbench附带以下基准测试:
- oltp_ *.Lua:类似OLTP的数据库基准测试集合
- fileio:文件系统基准测试
- CPU:简单的CPU基准测试
- 内存:内存访问基准
- 线程:基于线程的调度器基准
- 互斥:POSIX互斥基准
[翻译自:https://github.com/akopytov/sysbench]

2.sysbench帮助解读

执行sysbench –help,获得帮助文档,因为安装的版本是1.0.9,找到的资料是0.4和0.5的,好多参数都在最新的帮助中已经没有了。
1.0.9 帮助

[root@localhost ~]# 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             表示每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                最大请求数限制,默认1w。deprecated alias for --events [0]
  --max-time=N                    最大运行时间限制(秒),默认无限制。deprecated alias for --time [0]
  --num-threads=N                 线程使用数,默认1。deprecated alias for --threads [1]

Pseudo-Random Numbers Generator options:
  --rand-type=STRING 表示随机类型为固定模式,其他几个可选随机模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托)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       #表示设定采样比例,默认是 95%,即丢弃1%的长请求,在剩余的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  #数据库驱动(MySQL已经内编译可直接指定)。specifies database driver to use ('help' to get list of available drivers)
  --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                #测试用schema,默认sbtest。MySQL database name [sbtest]
  --mysql-ssl[=on|off]             #use SSL connections, if available in the client libr
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d 这是MySQL数据库的配置文件,以下是每条配置的翻译: [mysqld] - datadir=/var/lib/mysql:指定MySQL数据库存储的目录。 - socket=/var/lib/mysql/mysql.sock:指定MySQL数据库与客户端通信的套接字文件。 - symbolic-links=0:禁用符号链接以预防各种安全风险。 - 在使用systemd时,user和group设置会被忽略。如果需要以不同的用户或组运行mysqld,请根据mariadb的systemd unit文件自定义配置,具体操作方式请参考http://fedoraproject.org/wiki/Systemd。 [mysqld_safe] - log-error=/var/log/mariadb/mariadb.log:指定MariaDB的错误日志文件路径。 - pid-file=/var/run/mariadb/mariadb.pid:指定MariaDB的进程ID文件路径。 !includedir /etc/my.cnf.d - 包含配置目录中的所有文件。 这些是MySQL/MariaDB数据库的配置项,用于指定数据库存储、通信、安全等方面的设置。具体的配置和参数设置可以根据需求进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值