標籤:style blog http io os 使用 ar strong for
MySQL基準測試載入器
mysqlslap、sysbench、Super Smack
mysqlslap的使用MySQL官網給出了介紹
Super Smack是伺服器壓力測試強有力的工具
sysbench是MySQL基準測試載入器了
sysbench安裝
直接yum安裝
測試環境
mysql> SELECT VERSION();+-----------+| VERSION() |+-----------+| 5.1.73 |+-----------+1 row in set (0.00 sec)
1:測試CPU
[[email protected] ~]# sysbench --test=cpu --cpu-max-prime=1500 run
2:測試fileio
首先組建檔案用於測試(預設產生128個單個16M共2G的檔案)
[[email protected] ~]# sysbench --test=fileio prepare
讀寫檔案測試
[[email protected] ~]# sysbench --test=fileio --file-test-mode=rndrw run
每秒請求數:Requests/sec 1841.10
總體輸送量:28.767Mb/sec
刪除測試資料:
[[email protected] ~]# sysbench --test=fileio cleanup
3:測試oltp(主要用來測試多線程交易處理)
首先建立資料庫和測試表
mysql> CREATE DATABASE gechong;Query OK, 1 row affected (0.00 sec)mysql> CREATE TABLE test_oltp -> SELECT * FROM mysql.user;ERROR 1046 (3D000): No database selectedmysql> USE gechong;Database changedmysql> CREATE TABLE test_oltp SELECT * FROM mysql.user;Query OK, 3 rows affected (0.01 sec)Records: 3 Duplicates: 0 Warnings: 0
[[email protected] ~]# sysbench --test=oltp --oltp-table-size=2000000 --oltp-table-name=test_oltp --mysql-db=gechong --mysql-user=root --msyql-password=gechong prepareUnknown option: --msyql-password.
提示建立失敗了。
查看下協助
sysbench [general-options]... --test=<test-name> [test-options] ... command
General options:
--num-threads=N number of threads to use [1]
--max-requests=N limit for total number of requests [10000]
--max-time=N limit for total execution time in seconds [0]
--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off]
--thread-stack-size=SIZE size of stack per thread [32K]
--init-rng=[on|off] initialize random number generator [off]
--test=STRING test to run
--debug=[on|off] print more debugging info [off]
--validate=[on|off] perform validation checks where possible [off]
--help=[on|off] print help and exit
--version=[on|off] print version and exit
Compiled-in tests:
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
command
prepare/run/cleanup/help/version
查看協助
[[email protected] ~]# sysbench --help=on --test=<oltp> help
MySQL基準測試