sysbench 有這些功能可以壓力測試
fileio - File I/O test cpu - CPU performance test memory - Memory functions speed test threads - Threads subsystem performance test mutex - Mutex performance test oltp - OLTP test
我找不到 source code (sysbench.sf.net 沒了 ?!)
不過 rpm 還有 http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
安裝
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
測試 CPU
sysbench --test=cpu --cpu-max-prime=2000 run
total time : 1.5542s
per-request avg : 0.16ms
sysbench 0.4.12: multi-threaded system evaluation 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: 1.5542s total number of events: 10000 total time taken by event execution: 1.5530 per-request statistics: min: 0.15ms avg: 0.16ms max: 0.34ms approx. 95 percentile: 0.16ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 1.5530/0.00
測試 IO
--num-threads 開啟線程數 --file-total-size總的文件大小 prepare,產生需要的測試文件(當下目錄) run,開始測試 cleanup,清理測試時產生的文件
sysbench --test=fileio --num-threads=20 --file-total-size=1G --file-test-mode=rndrw prepare sysbench --test=fileio --num-threads=20 --file-total-size=1G --file-test-mode=rndrw run sysbench --test=fileio --num-threads=20 --file-total-size=1G --file-test-mode=rndrw cleanup
Read : 93.766Mb
Written : 62.516Mb
不過我用 hdparm -t /dev/sda 測試讀則為 226.42 MB/sec
sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 20 Extra file open flags: 0 128 files, 8Mb each 1Gb 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: 6001 Read, 4001 Write, 12682 Other = 22684 Total Read 93.766Mb Written 62.516Mb Total transferred 156.28Mb (13.675Mb/sec) 875.20 Requests/sec executed Test execution summary: total time: 11.4282s total number of events: 10002 total time taken by event execution: 3.3165 per-request statistics: min: 0.00ms avg: 0.33ms max: 66.51ms approx. 95 percentile: 0.02ms Threads fairness: events (avg/stddev): 500.1000/203.61 execution time (avg/stddev): 0.1658/0.05
測試 Memory
注意 : 8K 與 1G 都要大寫
讀取
sysbench --test=memory --memory-block-size=8K --memory-total-size=1G --memory-oper=read run
19178.00 MB/sec
sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing memory operations speed test Memory block size: 8K Memory transfer size: 1024M Memory operations type: read Memory scope type: global Threads started! Done. Operations performed: 131072 (2454783.89 ops/sec) 1024.00 MB transferred (19178.00 MB/sec) Test execution summary: total time: 0.0534s total number of events: 131072 total time taken by event execution: 0.0400 per-request statistics: min: 0.00ms avg: 0.00ms max: 0.08ms approx. 95 percentile: 0.00ms Threads fairness: events (avg/stddev): 131072.0000/0.00 execution time (avg/stddev): 0.0400/0.00
寫入
sysbench --test=memory --memory-block-size=8K --memory-total-size=1G run
3311.62 MB/sec
sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing memory operations speed test Memory block size: 8K Memory transfer size: 1024M Memory operations type: write Memory scope type: global Threads started! Done. Operations performed: 131072 (423887.83 ops/sec) 1024.00 MB transferred (3311.62 MB/sec) Test execution summary: total time: 0.3092s total number of events: 131072 total time taken by event execution: 0.2966 per-request statistics: min: 0.00ms avg: 0.00ms max: 0.09ms approx. 95 percentile: 0.00ms Threads fairness: events (avg/stddev): 131072.0000/0.00 execution time (avg/stddev): 0.2966/0.00
參考
http://www.cnblogs.com/zhoujinyi/archive/2013/04/19/3029134.html
http://blogawake.org/2013/01/raspberry-pi-%E5%8B%95%E5%8B%95%E8%85%A6-%EF%BC%8D-sysbench/
留言
look at: http://wiki.mikejung.biz/Sysbench#Install_Sysbench_0.4.12_From_Repo_on_CentOS_6.5