/io# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw run
sysbench 0.4.12: multi-threaded system eva luation benchmark
Running the test with following options:
Number of threads: 20
Extra file open flags: 0
128 files, 16Mb each
2Gb 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: 6010 Read, 3997 Write, 12803 Other = 22810 Total
Read 93.906Mb Written 62.453Mb Total transferred 156.36Mb (6.6668Mb/sec)
426.68 Requests/sec executed
Test execution summary:
total time: 23.4534s
total number of events: 10007
total time taken by event execution: 111.5569
per-request statistics:
min: 0.01ms
avg: 11.15ms
max: 496.18ms
approx. 95 percentile: 53.05ms
Threads fairness:
events (avg/stddev): 500.3500/37.50
execution time (avg/stddev): 5.5778/0.21
root@db2:~/io# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw cleanup
sysbench 0.4.12: multi-threaded system eva luation benchmark
Removing test files...
4)测试内存:sysbench --test=memory --memory-block-size=8k --memory-total-size=1G run
sysbench 0.4.12: multi-threaded system eva luation benchmark
Operations performed: 1310720 (396525.32 ops/sec)
10240.00 MB transferred (3097.85 MB/sec)
Test execution summary:
total time: 3.3055s
total number of events: 1310720
total time taken by event execution: 205.0560
per-request statistics:
min: 0.00ms
avg: 0.16ms
max: 1066.04ms
approx. 95 percentile: 0.02ms
Threads fairness:
events (avg/stddev): 13107.2000/3870.38
execution time (avg/stddev): 2.0506/0.28
5)测试mutex:sysbench –test=mutex –num-threads=100 –mutex-num=1000 –mutex-locks=100000 –mutex-loops=10000 run
Test execution summary:
total time: 12.5606s
total number of events: 100
total time taken by event execution: 1164.4236
per-request statistics:
min: 9551.87ms
avg: 11644.24ms
max: 12525.32ms
approx. 95 percentile: 12326.25ms
Threads fairness:
events (avg/stddev): 1.0000/0.00
execution time (avg/stddev): 11.6442/0.59
6)测试OLTP:
1,prepare阶段,生成需要的测试表
这里要注意host的填写*(我在本地测试的,写的是127.0.0.1)
sysbench --test=oltp --mysql-table-engine=innodb --mysql-host=127.0.0.1 --mysql-db=test --oltp-table-size=500000 --mysql-user=root --mysql-password=123456 prepare
2,run阶段
sysbench --num-threads=16 --test=oltp --mysql-table-engine=innodb --mysql-host=192.168.x.x --mysql-db=test --oltp-table-size=500000 --mysql-user=root --mysql-password=123456 run
3,清理测试时生成的测试表
sysbench --num-threads=16 --test=oltp --mysql-table-engine=innodb --mysql-host=192.168.x.x --mysql-db=test --oltp-table-size=500000 --mysql-user=root --mysql-password=123456 cleanup
root@db2:~# sysbench --test=oltp --mysql-table-engine=innodb --mysql-host=192.168.x.x --mysql-db=rep_test --oltp-table-size=1000000 --mysql-user=root --mysql-password=123456 prepare
sysbench 0.4.12: multi-threaded system eva luation benchmark
No DB drivers specified, using mysql
Creating table 'sbtest'...
Creating 1000000 records in table 'sbtest