10000
--oltp-dist-type=STRING 分布的随机数{uniform(均匀分布),Gaussian(高斯分布),special(空间分布)}。默认是special
--oltp-dist-iter=N 产生数的迭代次数。默认是12
--oltp-dist-pct=N 值的百分比被视为'special' (for special distribution)。默认是1
--oltp-dist-res=N ‘special’的百分比值。默认是75
General database options:
--db-driver=STRING 数据库类型,指定数据库驱动程序('help' to get list of available drivers)
--db-ps-mode=STRING 数据库预处理模式{auto, disable} [auto]
Compiled-in database drivers:
mysql - MySQL driver
mysql options:
--mysql-host=[LIST,...] MySQL server host [localhost]
--mysql-port=N MySQL server port [3306]
--mysql-socket=STRING MySQL socket
--mysql-user=STRING MySQL user [sbtest]
--mysql-password=STRING MySQL password []
--mysql-db=STRING MySQL database name [sbtest]
--mysql-table-engine=STRING storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb]
--mysql-engine-trx=STRING whether storage engine used is transactional or not {yes,no,auto} [auto]
--mysql-ssl=[on|off] use SSL connections, if available in the client library [off]
--myisam-max-rows=N max-rows parameter for MyISAM tables [1000000]
--mysql-create-options=STRING additional options passed to CREATE TABLE []
测试:
1)测试CPU: sysbench --test=cpu --cpu-max-prime=2000 run
root@db2:~# sysbench --test=cpu --cpu-max-prime=2000 run
sysbench 0.4.12: multi-threaded system eva luation benchmark
Running the test with following options:
Number of threads: 1
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 2000
Test execution summary:
total time: 3.7155s
total number of events: 10000
total time taken by event execution: 3.7041
per-request statistics:
min: 0.36ms
avg: 0.37ms
max: 2.53ms
approx. 95 percentile: 0.37ms
Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 3.7041/0.00
2)测试线程:sysbench --test=threads --num-threads=500 --thread-yields=100 --thread-locks=4 run
root@db2:~# sysbench --test=threads --num-threads=500 --thread-yields=100 --thread-locks=4 run
sysbench 0.4.12: multi-threaded system eva luation benchmark
Running the test with following options:
Number of threads: 500
Doing thread subsystem performance test
Thread yields per test: 100 Locks used: 4
Threads started!
Done.
Test execution summary:
total time: 1.0644s
total number of events: 10000
total time taken by event execution: 501.3952
per-request statistics:
min: 0.05ms
avg: 50.14ms
max: 587.05ms
approx. 95 percentile: 190.28ms
Threads fairness:
events (avg/stddev): 20.0000/4.72
execution time (avg/stddev): 1.0028/0.01
3)测试IO:--num-threads 开启的线程 --file-total-size 总的文件大小
1,prepare阶段,生成需要的测试文件,完成后会在当前目录下生成很多小文件。
sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw prepare
2,run阶段
sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw run
3,清理测试时生成的文件
sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw cleanup
root@db2:~/io# sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw prepare
sysbench 0.4.12: multi-threaded system eva luation benchmark
128 files, 16384Kb each, 2048Mb total
Creating files for the test...
root@db2:~