Mysql基准测试
下载sysbench-0.4.10.tar.gz(http://download.chinaunix.net/download.php?id=26070&ResourceID=12695)
tar -zxvfsysbench-0.4.10.tar.gz
配置
./configure-prefix=/usr/local/sysbench -with-mysql-includes=/usr/include/mysql/-with-mysql-libs=/usr/lib64/mysql/
make&& make install
sysbench的cpu基准测试
cat/proc/cpuinfo | more
modelname : Intel(R) Xeon(R) CPU E7-8837 @ 2.67GHz
stepping : 2
cpuMHz : 2659.992
cachesize : 24576 KB
cpucores : 2
/usr/local/sysbench/bin/sysbench--test=cpu --cpu-max-prime=20000 run
Testexecution summary:
totaltime: 24.6696s
sysbench的文件I/O基准测试
准备测试数据10G
/usr/local/sysbench/bin/sysbench--test=fileio --file-total-size=10G prepare
/usr/local/sysbench/bin/sysbench--test=fileio --file-total-size=10G --file-test-mode=rndrw --init-rng=on--max-time=300 --max-requests=0 run
sysbench0.4.10: multi-threaded system evaluationbenchmark
Runningthe test with following options:
Number ofthreads: 1
Initializingrandom number generator from timer.
Extrafile open flags: 0
128files, 80Mb each
10Gbtotal file size
Blocksize 16Kb
Number ofrandom requests for random IO: 0
Read/Writeratio for combined random IO test: 1.50
PeriodicFSYNC enabled, calling fsync() each 100 requests.
Callingfsync() at the end of test, Enabled.
Usingsynchronous I/O mode
Doingrandom r/w test
Threadsstarted!
Timelimit exceeded, exiting...
Done.
Operationsperformed: 83947 Read, 55964 Write,179072 Other = 318983 Total
Read1.2809Gb Written 874.44Mb Total transferred 2.1349Gb (7.2867Mb/sec)
466.35 Requests/sec executed
Testexecution summary:
total time: 300.0135s
total number of events: 139911
total time taken by event execution:260.0970
per-request statistics:
min: 0.01ms
avg: 1.86ms
max: 196.41ms
approx. 95 percentile: 6.92ms
Threadsfairness:
events (avg/stddev): 139911.0000/0.00
execution time (avg/stddev): 260.0970/0.00
每秒请求数466.35 Requests 吞吐量7.2867Mb/sec
清扫战场
/usr/local/sysbench/bin/sysbench--test=fileio --file-total-size=10G cleanup
Sysbench的oltp基准测试
制造数据
/usr/local/sysbench/bin/sysbench--test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root--mysql-password='test' prepare
八个并发线程只读模式测试时长60秒:
/usr/local/sysbench/bin/sysbench--test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root--mysql-password='test' --max-time=60 --oltp-read-only=on --max-requests=0--num-threads=8 run
sysbench 0.4.10: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
WARNING: Preparing of "BEGIN" isunsupported, using emulation
(last message repeated 7 times)
Running the test with following options:
Number of threads: 8
Doing OLTP test.
Running mixed OLTP test
Doing read-only test
Using Special distribution (12iterations, 1 pct of values are returnedin 75 pct cases)
Using "BEGIN" for startingtransactions
Using auto_inc on the id column
Threads started!
Time limit exceeded, exiting...
(last message repeated 7 times)
Done.
OLTP test statistics:
queries performed:
read: 551124
write: 0
other: 78732
total: 629856
transactions: 39366 (656.05 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 551124 (9184.64 per sec.)
other operations: 78732 (1312.09 per sec.)
Test execution summary:
total time: 60.0050s
total number of events: 39366
total time taken by event execution: 479.7678
per-request statistics:
min: 2.19ms
avg: 12.19ms
max: 133.47ms
approx. 95 percentile: 18.11ms
Threads fairness:
events (avg/stddev): 4920.7500/75.30
execution time (avg/stddev): 59.9710/0.00