sysbench
是一款开源的多
线程
性能测试
工具,可以执行
CPU
/
内存
/
线程
/
IO
/
数据库
等方面的性能测试。
数据库
目前支持
MySQL
/
Oracle
/PostgreSQL。本文只是简单演示一下几种测试的用法,后续准备利用
sysbench
来对MySQL进行一系列的测试。具体的一些参数设置,需要根据不同的测试要求来进行调整
root@xuebinbin:~# sysbench --mysql-db=test --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/tmp/mysqld.sock prepare
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Creating table 'sbtest'...
Creating 1000000 records in table 'sbtest'...
root@xuebinbin:~# sysbench --mysql-db=test --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/tmp/mysqld.sock run
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 1
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 10000
Threads started!
Done.
OLTP test statistics:
queries performed:
read: 140000
write: 50000
other: 20000
total: 210000
transactions: 10000 (172.01 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (3268.24 per sec.)
other operations: 20000 (344.02 per sec.)
Test execution summary:
total time: 58.1353s
total number of events: 10000
total time taken by event execution: 58.0398
per-request statistics:
min: 2.67ms
avg: 5.80ms
max: 235.95ms
approx. 95 percentile: 8.79ms
Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 58.0398/0.00
root@xuebinbin:~# sysbench --mysql-db=test --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/tmp/mysqld.sock cleanup
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Dropping table 'sbtest'...
Done.
root@xuebinbin:~# sysbench --mysql-db=test --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/tmp/mysqld.sock prepare
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Creating table 'sbtest'...
Creating 1000000 records in table 'sbtest'...
root@xuebinbin:~# sysbench --mysql-db=test --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/tmp/mysqld.sock run
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 1
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Maximum number of requests for OLTP test is limited to 10000
Threads started!
Done.
OLTP test statistics:
queries performed:
read: 140000
write: 50000
other: 20000
total: 210000
transactions: 10000 (172.01 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (3268.24 per sec.)
other operations: 20000 (344.02 per sec.)
Test execution summary:
total time: 58.1353s
total number of events: 10000
total time taken by event execution: 58.0398
per-request statistics:
min: 2.67ms
avg: 5.80ms
max: 235.95ms
approx. 95 percentile: 8.79ms
Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 58.0398/0.00
root@xuebinbin:~# sysbench --mysql-db=test --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-socket=/tmp/mysqld.sock cleanup
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Dropping table 'sbtest'...
Done.