• sysbench 压力测试使用手册


    部署

    1.1 官方主页

    https://github.com/Percona-Lab/sysbench-tpcc

    https://github.com/akopytov/sysbench

    1.2 安装

    Percona安装源(yum源)

    Wget

    https://www.percona.com/redir/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm

        yum -y install percona-release-0.1-6.noarch.rpm

    yum -y install sysbench

    yum install -y sysbench-tpcc

    Percona安装源(yum源)

    [root@zhumh ~]# wget https://www.percona.com/redir/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm

    [root@zhumh ~]# yum -y install percona-release-0.1-6.noarch.rpm

    [root@zhumh ~]# yum -y install sysbench

    [root@zhumh ~]# yum install -y sysbench-tpcc

    帮助文档

    [root@zhumh ~]# 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]

                                        使用的线程数为1

      --events=N                      limit for total number of events [0]

                                        事件总数的限制

      --time=N                        limit for total execution time in seconds [10]

                                        在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]

                                       每个线程的堆栈大小64K

      --rate=N                        average transactions rate. 0 for unlimited rate [0]

                                       平均事务率。0的无限速率

      --report-interval=N             periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]

    定期报告中间统计数据,并在几秒钟内指定时间间隔。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. []

    转储完整的统计信息,并在指定的时间点重置所有计数器。这个参数是一个逗号分隔值的列表,它表示在必须执行报告检查点(s)时从测试开始时所花费的时间。报告检查点在默认情况下是关闭的。

      --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类型=字符串随机数字分布uniform,gaussian,special,pareto} [special]

      --rand-spec-iter=N number of iterations used for numbers generation [12]

        rand speciter=N的迭代次数,用于数字生成12

      --rand-spec-pct=N  percentage of values to be treated as 'special' (for special distribution) [1]

        rand spec-pct=N的值被视为“特殊的”(特殊分配)

      --rand-spec-res=N  percentage of 'special' values to use (for special distribution) [75]

        rand spec-res=N的"特殊"值的百分比(用于特殊分配)

      --rand-seed=N      seed for random number generator. When 0, the current time is used as a RNG seed. [0]

        rand-seed=N随机数字生成器的种子。当0时,当前时间被用作RNG种子

      --rand-pareto-h=N  parameter h for pareto distibution [0.2]  rand-pareto-h=N pareto的参数

    Log options:

      --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]   冗长的5级——调试,0——只有关键信息3

      --percentile=N       percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]    在延迟统计(1-100)中计算百分比。使用0的特殊值来禁用百分位数计算

      --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)

                             指定要使用的数据库驱动程序(“帮助”获取可用驱动程序的列表)

      --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

    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]

                                       如果在客户端库中可用,则使用SSL连接

      --mysql-ssl-cipher=STRING     use specific cipher for SSL connections []  为SSL连接使用特定的密码

      --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]    忽略的错误列表,或“全部”1213,1020,1205

      --mysql-dry-run[=on|off]         Dry run, pretend that all MySQL client API calls are successful without executing them [off]

    干式运行,假设所有MySQL客户端API调用都是成功的,而不需要执行它们

    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.

    [root@zhumh ~]# sysbench fileio help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    fileio options:

      --file-num=N              number of files to create [128]   创建128个文件的数量

      --file-block-size=N       block size to use in all IO operations [16384]  在所有IO操作中使用的块大小为16384

      --file-total-size=SIZE    total size of files to create [2G]  创建2G文件的总大小

      --file-test-mode=STRING   test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}

                                 测试模式seqwr,seqrewr,seqrd,rndrd,rndwr,rndrw

      --file-io-mode=STRING     file operations mode {sync,async,mmap} [sync]  文件操作模式同步,异步,mmap同步

      --file-async-backlog=N    number of asynchronous operatons to queue per thread [128]

                                 每个线程排队的异步操作数

      --file-extra-flags=STRING additional flags to use on opening files {sync,dsync,direct} []

                                 打开文件同步,dsync,直接使用的其他标志

      --file-fsync-freq=N       do fsync() after this number of requests (0 - don't use fsync()) [100]

                                 在此请求数之后不要使用fsync,请执行fsync

      --file-fsync-all[=on|off] do fsync() after each write operation [off]  在每次写操作结束后执行fsync

      --file-fsync-end[=on|off] do fsync() at the end of test [on]   在测试结束时做fsync

      --file-fsync-mode=STRING  which method to use for synchronization {fsync, fdatasync} [fsync]

                                  用于同步fsync、fdatasync fsync的方法

      --file-merged-requests=N  merge at most this number of IO requests if possible (0 - don't merge) [0]

                                  如果可能的话,最多合并IO请求的数量

      --file-rw-ratio=N         reads/writes ratio for combined test [1.5]    组合测试1.5的读/写比率

    [root@zhumh ~]# sysbench memory help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    memory options:

      --memory-block-size=SIZE    size of memory block for test [1K]  测试1K的内存块大小

      --memory-total-size=SIZE    total size of data to transfer [100G]  数据传输总量的总规模

      --memory-scope=STRING    memory access scope {global,local} [global]  内存访问范围全局,本地全局

      --memory-hugetlb[=on|off]   allocate memory from HugeTLB pool [off]   从HugeTLB的池中分配内存 

      --memory-oper=STRING      type of memory operations {read, write, none} [write] 

                                    类型的内存操作读取,写入,没有写入

      --memory-access-mode=STRING memory access mode {seq,rnd} [seq]  内存访问模式seq,rnd seq

    [root@zhumh ~]# sysbench threads help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    threads options:

      --thread-yields=N number of yields to do per request [1000]   每个请求的产量数

      --thread-locks=N  number of locks per thread [8]  每个线程8的锁数

    [root@zhumh ~]# sysbench mutex help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    mutex options:

      --mutex-num=N   total size of mutex array [4096]  互斥锁的总大小4096

      --mutex-locks=N number of mutex locks to do per thread [50000]   每线程50000个互斥锁的数量

      --mutex-loops=N number of empty loops to do inside mutex lock [10000]  在互斥锁中执行的空循环数

    [root@zhumh ~]# sysbench cpu help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    cpu options:

      --cpu-max-prime=N upper limit for primes generator [10000]   启动 primes generator10000的上限

    使用方法

    3.1 命令格式

    sysbench [options]... [testname] [command]

    3.2 Command

    Commands implemented by most tests: prepare run cleanup help

     

        prepare            --生成测试需要的数据

        run                --进行性能测试

        cleanup            --清除测试数据

    3.3 Testname

    包括两种:内建脚本和lua脚本

    内建脚本如下:

      fileio - File I/O test

      cpu - CPU performance test

      memory - Memory functions speed test

      threads - Threads subsystem performance test

      mutex - Mutex performance test

    lua脚本如下:

    [root@zhumh ~]# ll /usr/share/sysbench/

    total 64

    -rwxr-xr-x 1 root root  1452 Feb 17 18:01 bulk_insert.lua

    -rw-r--r-- 1 root root 13756 Feb 17 18:01 oltp_common.lua

    -rwxr-xr-x 1 root root  1116 Feb 17 18:01 oltp_delete.lua

    -rwxr-xr-x 1 root root  1957 Feb 17 18:01 oltp_insert.lua

    -rwxr-xr-x 1 root root  1265 Feb 17 18:01 oltp_point_select.lua

    -rwxr-xr-x 1 root root  1649 Feb 17 18:01 oltp_read_only.lua

    -rwxr-xr-x 1 root root  1824 Feb 17 18:01 oltp_read_write.lua

    -rwxr-xr-x 1 root root  1118 Feb 17 18:01 oltp_update_index.lua

    -rwxr-xr-x 1 root root  1127 Feb 17 18:01 oltp_update_non_index.lua

    -rwxr-xr-x 1 root root  1440 Feb 17 18:01 oltp_write_only.lua

    -rwxr-xr-x 1 root root  1919 Feb 17 18:01 select_random_points.lua

    -rwxr-xr-x 1 root root  2118 Feb 17 18:01 select_random_ranges.lua

    drwxr-xr-x 4 root root  4096 Apr 13 14:04 tests

    3.4 Options

    3.4.1 全局参数

    General options:

      --threads=N                     指定测试使用多少线程数,默认为1

      --events=N                      测试执行的总events数量,默认0

      --time=N                        最大执行时间,单位为秒。默认是10

      --forced-shutdown=STRING        超过max-time强制中断, 默认是 off [off]

      --thread-stack-size=SIZE        每个线程的堆栈大小, 默认是 64k

      --rate=N                        average transactions rate. 0 for unlimited rate [0]

      --report-interval=N             在N秒内输出一次统计数据。默认0禁用

      --report-checkpoints=[LIST,...] 转储完全统计信息并在指定时间点复位所有计数器。 参数是逗号分隔值的列表,表示从必须执行报告检查点的测试开始所经过的时间(以秒为单位)。 默认情况下,报告检查点处于关闭状态

      --debug[=on|off]               是否显示更多的调试信息, 默认是off

    --validate[=on|off]             在可能情况下执行验证检查, 默认是off。

      --help[=on|off]                 输出 help 信息, 并退出

      --version[=on|off]              输出版本信息, 并退出

      --config-file=FILENAME          配置文件

      --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]

    3.4.2 伪随机数

    Pseudo-Random Numbers Generator options:

    --rand-type=STRING 分布的随机数{uniform(均匀分布),Gaussian(高斯分布),special(空间分布)}。默认是special

      --rand-spec-iter=N 产生数的迭代次数。默认是12

      --rand-spec-pct=N  值的百分比被视为’special’ (for special distribution)。默认是1

      --rand-spec-res=N  'special'的百分比值。默认是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  参数h用于 pareto 分布[0.2]

    3.4.3 日志

    Log options:

      --verbosity=N                  日志级别,默认为3,5=debug,0=只包含重要信息

      --percentile=N       表示设定采样比例,默认是 95%,即丢弃5%的长请求,在剩余的95%里取最大值 [95]

      --histogram[=on|off] print latency histogram in report [off]

    3.4.4 数据库

    General database options:

      --db-driver=STRING  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]

    3.4.5 Mysql

    Compiled-in database drivers:

      mysql - MySQL 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]

    3.4.6 fileio

    [root@zhumh ~]# sysbench fileio help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    fileio options:

      --file-num=N             指定测试生成多少文件[128]

      --file-block-size=N        指定测试块的大小(通常测试mysql默认为16k[16384],或8k[8192])[16384]

      --file-total-size=SIZE      指定测试生成总文件大小(file-total-size/file-num=文件个数)[2G]

      --file-test-mode=STRING   --指定测试磁盘IO的模式

            seqwr       顺序写

            seqrewr     顺序读写

            seqrd       顺序读

            rndrd       随机读

            rndwr       随机写

            rndrw       随机读写

      --file-io-mode=STRING    文件操作模式{sync(同步),async(异步),fastmmap(快速map映射),slowmmap(慢map映射)}。默认是sync

      --file-async-backlog=N    对应每个线程队列的异步操作数,默认为128。

      --file-extra-flags=STRING 使用额外的标志来打开文件(sync,dsync,direct),mysql通常用direct方式

      --file-fsync-freq=N       --执行fsync()的频率,默认为100,0为不使用 (0 - don't use fsync()) [100]

      --file-fsync-all[=on|off] do fsync()--每次执行完一次写操作就执行一次fsync(),默认为off

      --file-fsync-end[=on|off] --在测试结束时才执行fsync。默认是on

      --file-fsync-mode=STRING  用什么样的模式来同步文件fsync, fdatasync (see above) fsync

      --file-merged-requests=N  --如果可以,合并最多的IO请求数(0 – 表示不合并)。默认是0

      --file-rw-ratio=N         --测试时的读写比例。默认是1.5

    生成测试用的数据文件,要求生成的数据文件至少要比内存大,否则数据由于被操作系统缓存而无法体现 I/O 密集型工作负载。

    3.4.7 cpu

    [root@zhumh ~]# sysbench cpu help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    cpu options:

      --cpu-max-prime=N upper limit for primes generator [10000]

    cpu 测试为测试计算素数直到某个最大值所需的时间。–cpu-max-prime指定这个最大素数值 
    sysben测试cpu时,为什么采用素数加法运算? 
    在这种模式下每个请求在于计算素数——cpu-max-primes选项指定一个值。所有的计算执行使用64位的整数。

    3.4.8 memory

    [root@zhumh ~]# sysbench memory help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    memory options:

    –memory-block-size=SIZE 测试内存块的大小,默认为1K 
    –memory-total-size=SIZE 数据传输的总大小,默认为100G 
    –memory-scope=STRING 内存访问的范围,包括全局和本地范围,默认为global 
    –memory-hugetlb=[on|off] 是否从HugeTLB池分配内存的开关,默认为off 
    –memory-oper=STRING 内存操作的类型,包括read, write, none,默认为write 
    –memory-access-mode=STRING 内存访问模式,包括seq,rnd两种模式,默认为seq

    3.4.9 threads

    [root@zhumh ~]# sysbench threads help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    threads options:

    1. --thread-yields=N number of yields to do per request [1000] 每个请求产生多少个线程,默认[1000]
    2. --thread-locks=N number of locks per thread [8]    每个线程的锁数量,默认 [8]

    线程调度:线程并发执行,循环响应信号量花费的时间{越少越好}
    测试线程调度器的性能。对于高负载情况下测试线程调度器的行为非常有用

    3.4.10 mutex

    [root@zhumh ~]# sysbench mutex help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    mutex options:

    1. --mutex-num=N total size of mutex array [4096] 数组互斥总大小,默认[4096]
    2. --mutex-locks=N number of mutex locks to do per thread [50000] 每个线程互斥锁的数量,默认 [50000]
    3. --mutex-loops=N number of empty loops to do inside mutex lock [10000] 内部互斥锁的空循环数量,默认 [10000

    互斥锁:并发线程同时申请互斥锁循环一定次数花费的时间{越少越好}

    测试互斥锁的性能,方式是模拟所有线程在同一时刻并发运行,并都短暂请求互斥锁

    3.4.11 OLTP

    [root@zhumh ~]# sysbench /usr/share/sysbench/oltp_common.lua help

    sysbench 1.0.2 (using bundled LuaJIT 2.1.0-beta2)

    oltp_common.lua options:

      --distinct_ranges=N           Number of SELECT DISTINCT queries per transaction [1]

                                     每个事务选择不同查询的数量

      --sum_ranges=N              Number of SELECT SUM() queries per transaction [1]

                                     每个事务1的SELECT SUM()查询数                            

      --skip_trx[=on|off]           Don't start explicit transactions and execute all queries as in the AUTOCOMMIT mode [off]

                                     不启动显式的事务,在自动提交模式下执行所有查询

      --secondary[=on|off]          Use a secondary index in place of the PRIMARY KEY [off]

                                      使用一个二级索引来代替主键

      --create_secondary[=on|off]   Create a secondary index in addition to the PRIMARY KEY [on]

                                      除了主键之外,还可以创建一个二级索引

      --index_updates=N             Number of UPDATE index queries per transaction [1]

                                      每个事务的更新索引查询数量

      --range_size=N                Range size for range SELECT queries [100]

                                      范围选择查询100

      --auto_inc[=on|off]           Use AUTO_INCREMENT column as Primary Key (for MySQL), or its alternatives in other DBMS. When disabled, use client-generated IDs [on]

        使用autoincrement列作为主键(MySQL自增键),或者在其他DBMS中使用它的替代品。当禁用时,使用客户机生成的id

      --delete_inserts=N            Number of DELETE/INSERT combination per transaction [1]

                                      每个事务的删除/插入组合数

      --tables=N                    Number of tables [1]      表的数量

      --mysql_storage_engine=STRING Storage engine, if MySQL is used [innodb]

          mysqlstorageengine=字符串存储引擎,如果MySQL使用innodb

      --non_index_updates=N         Number of UPDATE non-index queries per transaction [1]

                                        每个事务更新非索引查询的数量

      --table_size=N                Number of rows per table [10000]   每表10000行数

      --pgsql_variant=STRING        Use this PostgreSQL variant when running with the PostgreSQL driver. The only currently supported variant is 'redshift'. When enabled, create_secondary is automatically disabled, and delete_inserts is set to 0

    在PostgreSQL驱动程序运行时使用此PostgreSQL变量。目前唯一支持的变体‘redshift’是启用后,CealEdieAudio将自动禁用,DeleTeEnEdvts设置为0。

      --simple_ranges=N             Number of simple range SELECT queries per transaction [1]

    每个事务简单范围选择查询的数量

      --order_ranges=N              Number of SELECT ORDER BY queries per transaction [1]

                                      每个事务查询的选择顺序数

      --range_selects[=on|off]      Enable/disable all range SELECT queries [on]

                                      启用/禁用所有范围选择查询

      --point_selects=N             Number of point SELECT queries per transaction [10]

    每个事务10的点选择查询数

                                       

    测试样例

    4.1 Mysql

    4.1.1 准备

    创建sbtest数据库

    Create database sbtest;

    4.1.2 测试脚本

    sysbench --threads=10 --tables=10 --table-size=100000 --rand-type=uniform --report-interval=1 --time=60  --mysql-user=root --mysql-password=root --mysql-socket=/data/mysql/db_zhumh/mysql.sock   /usr/share/sysbench/oltp_read_write.lua prepare

    sysbench --threads=10 --tables=10 --table-size=100000 --rand-type=uniform --report-interval=1 --time=60  --mysql-user=root --mysql-password=root --mysql-socket=/data/mysql/db_zhumh/mysql.sock   /usr/share/sysbench/oltp_read_write.lua run

    4.2 IO

    --创建10G的文件,分成4个,测试16K块大小,使用direct方式读,测试600秒(10分钟),启用64个线程,每3秒输出一次结果

    #sysbench  --file-num=4 --file-block-size=16384 --file-total-size=10G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=600 --num-threads=64 --report-interval=3  fileio  prepare  

    #sysbench  --file-num=4 --file-block-size=16384 --file-total-size=10G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=600 --num-threads=64 --report-interval=3  fileio  run

    #sysbench   --file-num=4 --file-block-size=16384 --file-total-size=10G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=600 --num-threads=64 --report-interval=3 fileio  cleanup

    磁盘:S3610 * 6 raid10, 内存128G

    测试出相关场景下的极限IOPS

    随机读写(3:2 oltp场景)

     sysbench --num-threads=16 --report-interval=3 --max-requests=0 --max-time=300  --test=fileio --file-num=200 --file-total-size=200G --file-test-mode=rndrw --file-block-size=16384 --file-extra-flags=direct run

    fileio_oltp_32

    随机读写(5:1 oltp场景)

     sysbench --num-threads=16 --report-interval=3 --max-requests=0 --max-time=300  --test=fileio --file-num=200 --file-total-size=200G --file-test-mode=rndrw --file-block-size=16384 --file-extra-flags=direct --file-rw-ratio=5  run

    fileio_oltp_51

    随机写

     sysbench --num-threads=16 --report-interval=3 --max-requests=0 --max-time=300  --test=fileio --file-num=200 --file-total-size=200G --file-test-mode=rndwr --file-block-size=16384 --file-extra-flags=direct run

    fileio_rndwr

    随机读

     sysbench --num-threads=16 --report-interval=3 --max-requests=0 --max-time=300  --test=fileio --file-num=200 --file-total-size=200G --file-test-mode=rndrd --file-block-size=16384 --file-extra-flags=direct run

    Tpcc

    5.1 Option

    [root@localhost sysbench]# sysbench /usr/share/sysbench/tpcc.lua help  

    sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

    tpcc.lua options:

      --enable_purge=STRING          Use purge transaction (yes, no) [no]

      --force_pk=N                   Force using auto-inc PK on history table [0]

      --mysql_storage_engine=STRING   Storage engine, if MySQL is used [innodb]

      --mysql_table_options=STRING    Extra table options, if MySQL is used. e.g. 'COLLATE latin1_bin' []

      --report_csv=STRING             Report output in csv (yes, no) [no]

      --scale=N                      Scale factor (warehouses) [100]

      --tables=N                     Number of tables [1]

      --trx_level=STRING              Transaction isolation level (RC, RR or SER) [RR]

      --use_fk=N                     Use foreign keys [1]

    5.2 测试脚本

    ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=zabbix.9.31 --mysql-db=sbt --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql prepare

    ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=zabbix.9.31 --mysql-db=sbt --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql run

    ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=zabbix.9.31 --mysql-db=sbt --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql cleanup

    6 操作步骤

    安装:

     (准备条件:sysbench-1.0.15-1.el7.centos.x86_64,percona-release-0.1-6.noarch两个包)

     

    6.1 root用户随便建个文件夹

    sysbench-1.0.15-1.el7.centos.x86_64,percona-release-0.1-6.noarch两个包扔进去

     

    6.2 环境准备

    yum -y install make automake libtool pkgconfig libaio-devel

    yum -y install mariadb-devel openssl-devel

    yum -y install postgresql-devel

    6.3安装

    # rpm -ivh percona-release-0.1-6.noarch.rpm

    # rpm -ivh sysbench-1.0.15-1.el7.centos.x86_64.rpm

     

     

     

     

     

     

     

     

    6.4 验证

    [root@bogon ~]# sysbench --help

    有结果返回,验证成功

     

    7 压力测试

    7.1 先创建一个测试的数据库

    mysql> create database sbtest;

    Query OK, 1 row affected (1.10 sec)

    mysql> show databases;

     

     

     

     

    7.2 查看本地socket地址

    mysql> select @@socket;

    7.3 准备测试环境:

    [root@bogon ~]# sysbench --threads=10 --tables=10 --table-size=100000 --rand-type=uniform --report-interval=1 --time=60 --mysql-user=root --mysql-password=oracle --mysql-socket=/mysqldb/db_master/mysql.sock /usr/share/sysbench/oltp_read_write.lua prepare

    7.4开始运行增压

    [root@bogon ~]# sysbench --threads=10 --tables=10 --table-size=100000 --rand-type=uniform --report-interval=1 --time=60  --mysql-user=root --mysql-password=oracle --mysql-socket=/home/mysql/mysqldb/db_master/mysql.sock   /usr/share/sysbench/oltp_read_write.lua run

    8 测试结果

    8.1  cpu 测试

     

    [root@oracle01 ~]# sysbench --threads=10 --tables=10 --table-size=100000 --rand-type=uniform --report-interval=1 --time=10  --mysql-user=root --mysql-password=oracle --mysql-socket=/mysqldb/db_master/mysql.sock   /usr/share/sysbench/oltp_read_write.lua run

    sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

    Running the test with following options:

    Number of threads: 10

    Report intermediate results every 1 second(s)

    Initializing random number generator from current time

    Initializing worker threads...

    Threads started!

    [ 1s ] thds: 10 tps: 0.00 qps: 98.65 (r/w/o: 88.79/0.00/9.87) lat (ms,95%): 0.00 err/s: 0.00 reconn/s: 0.00

    [ 2s ] thds: 10 tps: 1.00 qps: 80.22 (r/w/o: 51.14/27.07/2.01) lat (ms,95%): 1803.47 err/s: 0.00 reconn/s: 0.00

    [ 3s ] thds: 10 tps: 9.02 qps: 112.28 (r/w/o: 81.21/13.03/18.05) lat (ms,95%): 2493.86 err/s: 0.00 reconn/s: 0.00

    [ 4s ] thds: 10 tps: 2.01 qps: 86.36 (r/w/o: 58.25/24.10/4.02) lat (ms,95%): 2198.52 err/s: 0.00 reconn/s: 0.00

    [ 5s ] thds: 10 tps: 7.95 qps: 121.18 (r/w/o: 89.40/15.89/15.89) lat (ms,95%): 2279.14 err/s: 0.00 reconn/s: 0.00

    [ 6s ] thds: 10 tps: 3.02 qps: 91.52 (r/w/o: 56.32/29.17/6.03) lat (ms,95%): 2238.47 err/s: 0.00 reconn/s: 0.00

    [ 7s ] thds: 10 tps: 7.01 qps: 83.07 (r/w/o: 58.05/11.01/14.01) lat (ms,95%): 2493.86 err/s: 0.00 reconn/s: 0.00

    [ 8s ] thds: 10 tps: 1.00 qps: 84.99 (r/w/o: 69.99/13.00/2.00) lat (ms,95%): 2362.72 err/s: 0.00 reconn/s: 0.00

    [ 9s ] thds: 10 tps: 8.00 qps: 102.01 (r/w/o: 62.00/24.00/16.00) lat (ms,95%): 2539.17 err/s: 0.00 reconn/s: 0.00

    [ 10s ] thds: 10 tps: 1.99 qps: 89.48 (r/w/o: 70.59/14.91/3.98) lat (ms,95%): 2632.28 err/s: 0.00 reconn/s: 0.00

    [ 11s ] thds: 10 tps: 8.99 qps: 67.92 (r/w/o: 26.97/31.96/8.99) lat (ms,95%): 2585.31 err/s: 0.00 reconn/s: 0.00

    SQL statistics:

        queries performed:

            read:                            714     --读总数

            write:                           204     --写总数

            other:                           102    --其他操作(CURD之外的操作,例如COMMIT)

            total:                           1020    --全部总数

        transactions:                        51     (4.62 per sec.)     --总事务数(每秒事务数)

        queries:                             1020   (92.48 per sec.)   --其他操作总数(每秒其他操作次数)

        ignored errors:                      0      (0.00 per sec.)     --总忽略错误总数(每秒忽略错误次数)

        reconnects:                          0      (0.00 per sec.)   --重连总数(每秒重连次数)

    Throughput:    --吞吐量

        events/s (eps):                      4.6238       

        time elapsed:                        11.0300s   --经历时间

    total number of events:              51          --事件总数

    Throughput = (number of requests) / (total time) 
    total time = 测试结束时间 - 测试开始时间 
    测试结束时间 = MAX(请求开始时间 + Elapsed Time) 
    测试开始时间 = MIN(请求开始时间) 

    Latency (ms):

             min:                                 1500.36

             avg:                                 2082.19

             max:                                 2633.22

             95th percentile:                     2493.86

             sum:                               106191.66

    Threads fairness:   --并发统计

        events (avg/stddev):           5.1000/0.30    --总处理事件数/标准偏差

        execution time (avg/stddev):   10.6192/0.29

    cpu测试主要是进行素数的加法运算

    8.2  IO测试

    [root@localhost ~]# sysbench  --file-num=4 --file-block-size=16384 --file-total-size=1G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=600 --num-threads=64 --report-interval=3  fileio  prepare  

    WARNING: --num-threads is deprecated, use --threads instead

    WARNING: --max-time is deprecated, use --time instead

    sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)

    4 files, 262144Kb each, 1024Mb total

    Creating files for the test...

    Extra file open flags: directio

    Reusing existing file test_file.0

    Creating file test_file.1

    Creating file test_file.2    (创建文件)

    Creating file test_file.3

    805306368 bytes written in 128.84 seconds (5.96 MiB/sec).

    [root@localhost ~]# sysbench  --file-num=4 --file-block-size=16384 --file-total-size=1G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=10 --num-threads=64 --report-interval=3  fileio  run

    WARNING: --num-threads is deprecated, use --threads instead

    WARNING: --max-time is deprecated, use --time instead

    sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)

    Running the test with following options:    使用以下选项运行测试:

    Number of threads: 64       线程数量:64

    Report intermediate results every 3 second(s)   每3秒(s)报告中间结果

    Initializing random number generator from current time   从当前时间初始化随机数生成器

      

    Extra file open flags: directio    额外的文件打开标志:方向

    4 files, 256MiB each            4个文件,256 mib

    1GiB total file size            1GB总文件大小

    Block size 16KiB                 块大小为16k

    Number of IO requests: 0         IO请求数:0

    Read/Write ratio for combined random IO test: 1.50   组合随机IO测试的读/写比率1.5

    Periodic FSYNC enabled, calling fsync() each 100 requests.

    启用了定期FSYNC,调用FSYNC每100个请求

    Calling fsync() at the end of test, Enabled.   在测试结束时调用fsync

    Using synchronous I/O mode   使用同步I / O模式

    Doing random read test   做随机读取测试

    Initializing worker threads...  初始化工作线程…

    Threads started!

    [ 3s ] reads: 2.34 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 877.615

    [ 6s ] reads: 3.45 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 657.933

    [ 9s ] reads: 3.38 MiB/s writes: 0.00 MiB/s fsyncs: 0.00/s latency (ms,95%): 646.192

    File operations:  文件操作

        reads/s:                      189.14   读的速率

        writes/s:                     0.00     写的速率

        fsyncs/s:                     0.00     fsync的速率

    Throughput:

        read, MiB/s:                  2.96  读的大小(m)

        written, MiB/s:               0.00   写的大小(m)

    General statistics:

        total time:                          10.4033s   总时间

        total number of events:              1969       事件总数量

    Latency (ms):

             min:                                   18.13

             avg:                                  331.26

             max:                                 1335.37

             95th percentile:                      746.32

             sum:                               652243.23

    Threads fairness:

        events (avg/stddev):           30.7656/3.41

        execution time (avg/stddev):   10.1913/0.13

    [root@localhost ~]# sysbench   --file-num=4 --file-block-size=16384 --file-total-size=1G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=10 --num-threads=64 --report-interval=3 fileio  cleanup

    WARNING: --num-threads is deprecated, use --threads instead

    WARNING: --max-time is deprecated, use --time instead

    sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)

    Removing test files...

     

    8.3  tpcc测试

    [root@oracle01 sysbench]# ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=oracle --mysql-db=sbtest --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql prepare

    sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)

    Initializing worker threads...

    Waiting on tables 30 sec

    Creating tables: 6

    Waiting on tables 30 sec

    Creating tables: 9

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Creating tables: 7

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Creating tables: 1

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Creating tables: 4

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Creating tables: 3

    Creating tables: 2

    Creating tables: 5

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Creating tables: 8

    Creating tables: 10

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Adding indexes 4 ...

    Adding indexes 1 ...

    Adding indexes 5 ...

    Adding indexes 6 ...

    Adding indexes 9 ...

    Adding FK 4 ...

    Adding FK 1 ...

    Adding indexes 8 ...

    Adding FK 5 ...

    Adding FK 6 ...

    Adding indexes 7 ...

    Adding FK 8 ...

    Adding indexes 2 ...

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Adding FK 9 ...

    Adding indexes 10 ...

    Waiting on tables 30 sec

    Adding FK 7 ...

    Adding indexes 3 ...

    Adding FK 2 ...

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Adding FK 10 ...

    Waiting on tables 30 sec

    Adding FK 3 ...

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    Waiting on tables 30 sec

    loading tables: 1 for warehouse: 5

    loading tables: 1 for warehouse: 1

    loading tables: 1 for warehouse: 4

    loading tables: 1 for warehouse: 6

    loading tables: 1 for warehouse: 8

    loading tables: 1 for warehouse: 9

    loading tables: 1 for warehouse: 7

    loading tables: 1 for warehouse: 2

    loading tables: 1 for warehouse: 10

    loading tables: 1 for warehouse: 3

    loading tables: 2 for warehouse: 5

    loading tables: 2 for warehouse: 10

    loading tables: 2 for warehouse: 7

    loading tables: 2 for warehouse: 1

    loading tables: 2 for warehouse: 2

    loading tables: 2 for warehouse: 6

    loading tables: 2 for warehouse: 8

    loading tables: 2 for warehouse: 3

    loading tables: 2 for warehouse: 9

    loading tables: 2 for warehouse: 4

    loading tables: 3 for warehouse: 5

    loading tables: 3 for warehouse: 10

    (准备环境:创建10张表)

    [root@oracle01 sysbench]# ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=oracle --mysql-db=sbtest --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql run

    sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)

    Running the test with following options:

    Number of threads: 64

    Report intermediate results every 1 second(s)

    Initializing random number generator from current time

    Initializing worker threads...

    Threads started!

    [ 1s ] thds: 64 tps: 0.00 qps: 263.25 (r/w/o: 86.89/51.87/124.49) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 2s ] thds: 64 tps: 0.00 qps: 171.77 (r/w/o: 103.82/67.95/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 3s ] thds: 64 tps: 0.00 qps: 36.10 (r/w/o: 20.06/16.05/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 4s ] thds: 64 tps: 0.00 qps: 28.00 (r/w/o: 13.00/15.00/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 5s ] thds: 64 tps: 2.00 qps: 65.98 (r/w/o: 26.99/34.99/4.00) lat (ms,95%): 4437.27 err/s 0.00 reconn/s: 0.00

    [ 6s ] thds: 64 tps: 0.00 qps: 29.00 (r/w/o: 16.00/13.00/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 7s ] thds: 64 tps: 1.00 qps: 47.06 (r/w/o: 29.04/16.02/2.00) lat (ms,95%): 6247.39 err/s 0.00 reconn/s: 0.00

    [ 8s ] thds: 64 tps: 1.00 qps: 37.00 (r/w/o: 21.00/14.00/2.00) lat (ms,95%): 7895.16 err/s 0.00 reconn/s: 0.00

    [ 9s ] thds: 64 tps: 0.00 qps: 37.94 (r/w/o: 30.95/6.99/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 10s ] thds: 64 tps: 1.00 qps: 21.97 (r/w/o: 6.99/12.98/2.00) lat (ms,95%): 9624.59 err/s 0.00 reconn/s: 0.00

    [ 11s ] thds: 64 tps: 1.00 qps: 17.01 (r/w/o: 8.01/5.00/4.00) lat (ms,95%): 10917.50 err/s 1.00 reconn/s: 0.00

    [ 12s ] thds: 64 tps: 0.00 qps: 10.00 (r/w/o: 3.00/7.00/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 13s ] thds: 64 tps: 0.00 qps: 13.03 (r/w/o: 6.01/7.02/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 14s ] thds: 64 tps: 0.00 qps: 13.00 (r/w/o: 9.00/4.00/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 15s ] thds: 64 tps: 0.00 qps: 22.00 (r/w/o: 9.00/13.00/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 16s ] thds: 64 tps: 1.00 qps: 43.99 (r/w/o: 14.00/26.00/4.00) lat (ms,95%): 15096.83 err/s 1.00 reconn/s: 0.00

    [ 17s ] thds: 64 tps: 0.00 qps: 30.92 (r/w/o: 18.95/11.97/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 18s ] thds: 64 tps: 1.00 qps: 48.09 (r/w/o: 22.04/22.04/4.01) lat (ms,95%): 17124.84 err/s 1.00 reconn/s: 0.00

    [ 19s ] thds: 64 tps: 5.00 qps: 54.04 (r/w/o: 21.02/23.02/10.01) lat (ms,95%): 19078.64 err/s 0.00 reconn/s: 0.00

    [ 20s ] thds: 64 tps: 0.00 qps: 26.98 (r/w/o: 6.00/20.99/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 21s ] thds: 64 tps: 0.00 qps: 20.53 (r/w/o: 13.14/7.39/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 23s ] thds: 64 tps: 3.62 qps: 21.21 (r/w/o: 5.17/7.76/8.28) lat (ms,95%): 21641.55 err/s 0.52 reconn/s: 0.00

    [ 24s ] thds: 64 tps: 0.00 qps: 83.61 (r/w/o: 36.51/47.11/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 25s ] thds: 64 tps: 0.00 qps: 44.03 (r/w/o: 24.02/20.01/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 26s ] thds: 64 tps: 0.00 qps: 41.95 (r/w/o: 22.88/19.07/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 27s ] thds: 64 tps: 0.00 qps: 43.52 (r/w/o: 20.31/23.21/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 28s ] thds: 64 tps: 0.00 qps: 34.93 (r/w/o: 20.38/14.55/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 29s ] thds: 64 tps: 0.00 qps: 60.02 (r/w/o: 28.07/30.01/1.94) lat (ms,95%): 0.00 err/s 0.97 reconn/s: 0.00

    [ 30s ] thds: 64 tps: 0.00 qps: 91.91 (r/w/o: 50.23/39.54/2.14) lat (ms,95%): 0.00 err/s 1.07 reconn/s: 0.00

    [ 31s ] thds: 64 tps: 0.00 qps: 26.01 (r/w/o: 11.00/15.00/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    [ 32s ] thds: 64 tps: 12.99 qps: 100.89 (r/w/o: 35.96/51.94/12.99) lat (ms,95%): 31587.21 err/s 0.00 reconn/s: 0.00

    [ 33s ] thds: 64 tps: 7.00 qps: 54.97 (r/w/o: 20.99/26.99/7.00) lat (ms,95%): 32745.49 err/s 0.00 reconn/s: 0.00

    [ 34s ] thds: 64 tps: 0.00 qps: 31.03 (r/w/o: 18.02/13.01/0.00) lat (ms,95%): 0.00 err/s 0.00 reconn/s: 0.00

    SQL statistics:

        queries performed:   --查询执行:

            read:                            1195    --读总数

            write:                           1171    --写总数

            other:                           308     --其他操作(CURD之外的操作,例如COMMIT)

            total:                           2674     --全部总数   

        transactions:                        84     (1.65 per sec.)--总事务数(每秒事务数)

        queries:                             2674   (52.47 per sec.)--其他操作总数(每秒其他操作次数)

        ignored errors:                      6      (0.12 per sec.)--总忽略错误总数(每秒忽略错误次数)

        reconnects:                          0      (0.00 per sec.)--重连总数(每秒重连次数)

    General statistics:  --常规统计

        total time:                          50.9527s   --总耗时

        total number of events:              84      --共发生多少事务数

    Latency (ms):

             min:                                 4420.74

             avg:                                30312.93

             max:                                50944.12

             95th percentile:                    46941.21

             sum:                              2546286.47

    Threads fairness:    --并发统计

        events (avg/stddev):           1.3125/0.46   --总处理事件数/标准偏差

        execution time (avg/stddev):   39.7857/6.21

    [root@oracle01 sysbench]# ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=oracle --mysql-db=sbtest --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql cleanup

    sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)

    Dropping tables '1'...

    Dropping tables '2'...

    Dropping tables '3'...

    Dropping tables '4'...

    Dropping tables '5'...

    Dropping tables '6'...

    Dropping tables '7'...

    Dropping tables '8'...

    Dropping tables '9'...

    Dropping tables '10'...

    (清除测试)

    9常用命令

    9.1  cpu测试

    准备

    [root@oracle01 ~]# sysbench --threads=10 --tables=10 --table-size=100000 --rand-type=uniform --report-interval=1 --time=10 --mysql-user=root --mysql-password=oracle --mysql-socket=/mysqldb/db_master/mysql.sock   /usr/share/sysbench/oltp_read_write.lua prepare

    运行

    [root@oracle01 ~]# sysbench --threads=10 --tables=10 --table-size=100000 --rand-type=uniform --report-interval=1 --time=10 --mysql-user=root --mysql-password=oracle --mysql-socket=/mysqldb/db_master/mysql.sock   /usr/share/sysbench/oltp_read_write.lua run

    清除

    [root@oracle01 ~]# sysbench --threads=10 --tables=10 --table-size=100000 --rand-type=uniform --report-interval=1 --time=10 --mysql-user=root --mysql-password=oracle --mysql-socket=/mysqldb/db_master/mysql.sock   /usr/share/sysbench/oltp_read_write.lua cleanup

    9.2 IO测试

    准备

    [root@oracle01 ~]# sysbench  --file-num=4 --file-block-size=16384 --file-total-size=1G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=600 --num-threads=64 --report-interval=3  fileio  prepare  

    运行

    [root@oracle01 ~]# sysbench  --file-num=4 --file-block-size=16384 --file-total-size=1G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=600 --num-threads=64 --report-interval=3  fileio run

    清除

    [root@oracle01 ~]# sysbench  --file-num=4 --file-block-size=16384 --file-total-size=1G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=600 --num-threads=64 --report-interval=3  fileio cleanup

    9.3 tpcc测试

     

    准备

    [root@oracle01 sysbench]# ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=oracle --mysql-db=sbtest --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql prepare

    运行

    [root@oracle01 sysbench]# ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=oracle --mysql-db=sbtest --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql run

    清除

    [root@oracle01 sysbench]# ./tpcc.lua --mysql-socket=/mysqldb/db_master/mysql.sock --mysql-user=root --mysql-password=oracle --mysql-db=sbtest --time=30 --threads=64 --report-interval=1 --tables=10 --scale=10 --db-driver=mysql cleanup

    9.4 磁盘测试

    准备

    [root@oracle01 sysbench]#sysbench --num-threads=16 --report-interval=3 --max-requests=0 --max-time=300  --test=fileio --file-num=200 --file-total-size=200G --file-test-mode=rndrw --file-block-size=16384 --file-extra-flags=direct prepare

    运行

    [root@oracle01 sysbench]#sysbench --num-threads=16 --report-interval=3 --max-requests=0 --max-time=300  --test=fileio --file-num=200 --file-total-size=200G --file-test-mode=rndrw --file-block-size=16384 --file-extra-flags=direct run

    清除

    [root@oracle01 sysbench]#sysbench --num-threads=16 --report-interval=3 --max-requests=0 --max-time=300  --test=fileio --file-num=200 --file-total-size=200G --file-test-mode=rndrw --file-block-size=16384 --file-extra-flags=direct cleanup

     

  • 相关阅读:
    sql把一个表的某几列的数据存到另一个表里
    java四舍五入保留两位小数4种方法
    SWT 全接触
    详解Java多线程编程中LockSupport
    详解Java多线程编程中LockSupport类的线程阻塞用法
    Java多线程中join方法的理解
    java 线程方法join的简单总结
    彻底理解ThreadLocal
    recyclerView 列表类控件卡顿优化
    Android中RelativeLayout和LinearLayout性能分析
  • 原文地址:https://www.cnblogs.com/lswei/p/9543247.html
Copyright © 2020-2023  润新知