sysbench测试工具

     sysbench支持oracle,pgsql,mysql

1、安装sysbench工具 系统是redhat 4.5
tar xzvf sysbench-0.4.12.tar.gz
cd sysbench-0.4.12
./autogen.sh
./configure --prefix=/usr --with-mysql=/usr/local/mysql  假设mysql安装在这个目录下
make
make install

2、创建测试文件
mkdir /test
cd /test
sysbench --test=fileio --num-threads=16 --file-total-size=300M --file-test-mode=rndrw prepare

3、测试IO性能
sysbench --test=fileio --num-threads=16 --file-total-size=300M --file-test-mode=rndrw run
会产生以下内容,主要关注花费了多少时间,每秒多少M,每秒多少个请求
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 16

Extra file open flags: 0
128 files, 2.3438Mb each
300Mb total file size
Block size 16Kb
Number of random requests for random IO: 10000
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Threads started!
Done.

Operations performed:  5996 Read, 4004 Write, 12800 Other = 22800 Total
Read 93.688Mb  Written 62.562Mb  Total transferred 156.25Mb  (26.713Mb/sec)
 1709.66 Requests/sec executed

Test execution summary:
    total time:                          5.8491s
    total number of events:              10000
    total time taken by event execution: 12.5045
    per-request statistics:
         min:                                  0.01ms
         avg:                                  1.25ms
         max:                                373.28ms
         approx.  95 percentile:               0.03ms

Threads fairness:
    events (avg/stddev):           625.0000/109.60
    execution time (avg/stddev):   0.7815/0.29

测试数据库性能

sysbench --test=oltp --num-threads=300 --max-requests=1000000  --oltp-table-size=5000000 --mysql-port=3306 --mysql-socket=/tmp/mysql.sock --mysql-user=root --mysql-password=000000 --mysql-db=test --oltp-test-mode=nontrx --oltp-nontrx-mode=insert run

几个比较重要的参数的解释

--num-threads 多少个线程

--max-requests 请求多少次

--oltp-test-mode  是用非事务还是事务模式 notrx是非事务模式

--oltp-nontrx-mode  用insert或者用select update delete 来测试语句

 

OLTP test statistics:
    queries performed:
        read:                            0
        write:                           1000129
        other:                           0
        total:                           1000129
    transactions:                        1000129 (9518.71 per sec.)
    deadlocks:                           0      (0.00 per sec.)
    read/write requests:                 1000129 (9518.71 per sec.)
    other operations:                    0      (0.00 per sec.)

Test execution summary:
    total time:                          105.0698s
    total number of events:              1000129
    total time taken by event execution: 31507.5405
    per-request statistics:
         min:                                  0.14ms
         avg:                                 31.50ms
         max:                                607.52ms
         approx.  95 percentile:              39.33ms

Threads fairness:
    events (avg/stddev):           3333.7633/3.04
    execution time (avg/stddev):   105.0251/0.02
 

 

 

 


 

你可能感兴趣的:(mysql,sysbench,职场,休闲)