sysbench測試軟體
sysbench是一款測試工具
主要包括以下幾種方式的測試:
1、cpu效能
2、磁碟io效能
3、排程程式效能
4、記憶體分配及傳輸速度
5、POSIX執行緒效能
6、資料庫效能(OLTP基準測試)現在sysbench主要支援 MySQL,pgsql,oracle 這3種資料庫
到下載安裝包.
[@more@]我這裡只對主機做一些測試
tar zxf sysbench-
cd sysbench-0.4.8
./configure –without-mysql
make
make install
比如我的 MySQL 喜歡自己安裝在 /usr/local/mysql 下,則按照以下方法編譯:
/configure --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib && make && make install當然了,用上面的引數編譯的話,就要確保您的 MySQL lib目錄下有對應的 so 文件,假如沒有,能夠自己下載 devel 或 share 包來安裝。另外,假如想要讓 sysbench 支援 pgsql/oracle 的話,就需要在編譯的時候加上引數
--with-pgsql或
--with-oracle這2個引數預設是關閉的,只有 MySQL 是預設支援的。
測試的時候注意thread數大於兩倍CPU數,測試檔案大小大於5倍記憶體大小。
拿兩臺機器,test1(8CPU,
1、 cpu效能測試
sysbench --test=cpu --num-threads=32 --cpu-max-prime=90000 run
cpu測試主要是進行素數的加法運算,在上面的例子中,指定了最大的素數為 90000,
root :/root>#sysbench --test=cpu --num-threads=32 --cpu-max-prime=90000 run
sysbench v
Running the test with following options:
Number of threads: 32
Doing CPU performance benchmark
Threads started!
Done.
Maximum prime number checked in CPU test: 90000
Test execution summary:
total time: 26.4945s
total number of events: 10000
total time taken by event execution: 837.0154
per-request statistics:
min: 0.0208s
avg: 0.0837s
max: 1.6919s
approx. 95 percentile: 0.3208s
Threads fairness:
events (avg/stddev): 312.5000/3.98
execution time (avg/stddev): 26.1567/0.25
2、執行緒測試
sysbench --test=threads --num-threads=512 --thread-yields=100 --thread-locks=2 run
thread-locks小於執行緒數除以2,lock越少,處理時間越長。
test1: sysbench --test=threads --num-threads=512 --thread-yields=100 --thread-locks=2 run
sysbench v
Running the test with following options:
Number of threads: 512
Doing thread subsystem performance test
Thread yields per test: 100 Locks used: 2
Threads started!
Done.
Test execution summary:
total time: 2.5360s
total number of events: 10000
total time taken by event execution: 1276.9943
per-request statistics:
min: 0.0003s
avg: 0.1277s
max: 0.6007s
approx. 95 percentile: 0.3051s
Threads fairness:
events (avg/stddev): 19.5312/3.36
execution time (avg/stddev): 2.4941/0.02
3、磁碟IO效能測試
sysbench --test=fileio --num-threads=16 --file-total-size=
sysbench --test=fileio --num-threads=16 --file-total-size=
sysbench --test=fileio --num-threads=16 --file-total-size=
CD到空間足夠的檔案系統,執行命令等待建立
test1:/root>#sysbench --test=fileio --num-threads=64 --file-total-size=
sysbench v
128 files, 98304Kb each, 12288Mb total
Creating files for the test...
test1: /root>#sysbench --test=fileio --num-threads=64 --file-total-size=
sysbench v
Running the test with following options:
Number of threads: 64
Extra file open flags: 0
128 files, 96Mb each
12Gb 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: 5991 Read, 4009 Write, 12424 Other = 22424 Total
Read 93.609Mb Written 62.641Mb Total transferred 156.25Mb (64.986Mb/sec)
4159.07 Requests/sec executed
Test execution summary:
total time: 2.4044s
total number of events: 10000
total time taken by event execution: 23.6357
per-request statistics:
min: 0.0000s
avg: 0.0024s
max: 0.3453s
approx. 95 percentile: 0.0161s
Threads fairness:
events (avg/stddev): 156.2500/48.33
execution time (avg/stddev): 0.3693/0.15
test2: sysbench --test=fileio --num-threads=64 --file-total-size=
sysbench v
Running the test with following options:
Number of threads: 64
Extra file open flags: 0
128 files, 96Mb each
12Gb 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: 5996 Read, 4011 Write, 11032 Other = 21039 Total
Read 93.688Mb Written 62.672Mb Total transferred 156.36Mb (19.025Mb/sec)
1217.61 Requests/sec executed
Test execution summary:
total time: 8.2186s
total number of events: 10007
total time taken by event execution: 82.9911
per-request statistics:
min: 0.0000s
avg: 0.0083s
max: 0.7963s
approx. 95 percentile: 0.0140s
Threads fairness:
events (avg/stddev): 156.3594/39.62
execution time (avg/stddev): 1.2967/0.50
我們看到兩臺機器的速度差好多,一個
sysbench --test=fileio --num-threads=64 --file-total-size=
4、記憶體測試
sysbench --test=memory --memory-block-size=8192 --memory-total-size=
test1:/root>#sysbench --test=memory --num-threads=32 --memory-block-size=8192 --memory-total-size=
sysbench v
Running the test with following options:
Number of threads: 32
Doing memory operations speed test
Memory block size: 8K
Memory transfer size:
Memory operations type: write
Memory scope type: global
Threads started!
WARNING: Operation time (0.000000) is less than minimal counted value, counting as 1.000000
WARNING: Percentile statistics will be inaccurate
Done.
Operations performed: 67108864 (404978.13 ops/sec)
524288.00 MB transferred (3163.89 MB/sec)
Test execution summary:
total time: 165.7098s
total number of events: 67108864
total time taken by event execution: 2255.6291
per-request statistics:
min: 0.0000s
avg: 0.0000s
max: 1.3688s
approx. 95 percentile: 0.0000s
Threads fairness:
events (avg/stddev): 2097152.0000/48708.11
execution time (avg/stddev): 70.4884/1.38
test2:
Test execution summary:
total time: 168.1723s
total number of events: 67108864
total time taken by event execution: 2317.9228
per-request statistics:
min: 0.0000s
avg: 0.0000s
max: 1.5573s
approx. 95 percentile: 0.0000s
Threads fairness:
events (avg/stddev): 2097152.0000/41302.17
execution time (avg/stddev): 72.4351/1.29
以下不是我測試的,為完整性,從下面網址拷過來的。
http://hi.baidu.com/tister/blog/item/1b0cc
5、OLTP測試
1 、準備資料
# sysbench --debug=off --test=oltp --mysql-host=
2、測試
# sysbench --debug=off --test=oltp --mysql-host=10.15.2.137 --mysql-user=test --mysql-password=test --oltp-table-size=1000000 --mysql-db=test --oltp-table-name=stest --num-threads=20 --max-requests=10000 --oltp-auto-inc=off --mysql-engine-trx=yes run
3、刪除資料
# sysbench --debug=off --test=oltp --mysql-host=10.15.2.137 --mysql-user=test --mysql-password=test --oltp-table-size=1000000 --mysql-db=test --oltp-table-name=stest --num-threads=20 --max-requests=10000 --oltp-auto-inc=off --mysql-engine-trx=yes cleanup
指定了表最大記錄數為 1000000,其他引數就很好理解了,主要是指定登入方式。測試 OLTP 時,能夠自己先建立資料庫 sbtest,或自己用引數 --mysql-db 來指定其他資料庫。--mysql-table-engine 還能夠指定為 innodb 等 MySQL 支援的表儲存引擎型別。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/668365/viewspace-1014757/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- sysbench 測試MySQLMySql
- sysbench測試mysql oltpMySql
- 使用sysbench測試Mysql效能MySql
- 軟體驗收測試 第三方軟體測試 軟體功能測試 軟體資訊保安測試
- MySQL基準測試工具sysbenchMySql
- Mysql 壓力測試工具sysbenchMySql
- 【Mysql】sysbench基準測試工具MySql
- 使用 sysbench 測試 MySQL 的效能MySql
- [轉帖]sysbench基準測試
- 【軟體測試】——介面測試
- 軟體測試——三、軟體測試的分類
- 軟體工程——軟體測試軟體工程
- 軟體測試
- 軟體測試教程之手機軟體測試方法
- 軟體測試學習教程—軟體測試質量
- 軟體測試學習 ——五種軟體測試模型模型
- 軟體測試-測試計劃
- mysql效能測試工具之sysbench薦MySql
- 使用 sysbench 測試 MySQL 的效能(二)MySql
- 【工具】基準測試工具之sysbench
- 軟體測試:軟體缺陷管理
- 軟體測試學習教程—軟體測試基本知識
- 軟體測試真的很重要!——軟體測試的作用
- 軟體測試書籍-學軟體測試最好的書
- 軟體測試入門【1】什麼是軟體測試
- 軟體測試模型模型
- 軟體測試概要
- 軟體測試模式模式
- 軟體測試工具
- 軟體測試感悟
- 軟體測試度量
- 軟體測試3.0
- 軟體測試方法
- 軟體效能測試
- 軟體測試流程
- 【軟體測試】缺陷
- 軟體測試:自動化測試
- 軟體測試技術-黑盒測試