決定你想用哪一種工具:
- MySQL基準套件
- Sysbench
- db_STRESS
- http://www.mysqlperformanceblog.com/2012/02/25/introducing-new-type-of-benchmark/
- 建立你自己的
首先下載sysbench
安裝:
- #焦油vxzf sysbench-0.4.12.tar.gz
- CD sysbench-0.4.12
- sysbench-0.4.12]#。/配置
- 如果碰上錯誤的libtool檢查後出
- sysbench-0.4.12]#
- sysbench-0.4.12]#make install的
- http://sysbench.sourceforge.net/docs/
- 應參照本手冊的所有指引。
#sysbench - 測試= OLTP幫助
編譯測試:
FILEIO - 文件I / O測試
CPU - CPU性能測試
內存 - 功能速度測試
線程 - 線程子系統性能測試
互斥 - 互斥性能測試
OLTP - OLTP測試
命令:準備運行清理的幫助版本
下面一些例子:
FILEIO -文件I / O測試
# sysbench --test=fileio help
fileio options:
--file-num=N number of files to create [128]
--file-block-size=N block size to use in all IO operations [16384]
--file-total-size=SIZE total size of files to create [2G]
--file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}
--file-io-mode=STRING file operations mode {sync,async,fastmmap,slowmmap} [sync]
--file-extra-flags=STRING additional flags to use on opening files {sync,dsync,direct} []
--file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100]
--file-fsync-all=[on|off] do fsync() after each write operation [off]
--file-fsync-end=[on|off] do fsync() at the end of test [on]
--file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync]
--file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0]
--file-rw-ratio=N reads/writes ratio for combined test [1.5]
- #sysbench - 測試= FILEIO準備
- #sysbench的 - 測試FILEIO - 的文件測試模式= rndwr運行
CPU - CPU性能測試
#sysbench - 測試= CPU幫助
cpu選項:
- CPU的最大素數= N上限為素數發生器[10000]
- #sysbench的 - 測試= CPU - NUM線程= 25運行
內存-功能速度測試
# sysbench --test=memory help
memory options:
--memory-block-size=SIZE size of memory block for test [1K]
--memory-total-size=SIZE total size of data to transfer [100G]
--memory-scope=STRING memory access scope {global,local} [global]
--memory-hugetlb=[on|off] allocate memory from HugeTLB pool [off]
--memory-oper=STRING type of memory operations {read, write, none} [write]
--memory-access-mode=STRING memory access mode {seq,rnd} [seq]
- #sysbench - 測試內存<memory選項運行
線程-線程子系統性能測試
# sysbench --test=threads help
threads options:
--thread-yields=N number of yields to do per request [1000]
--thread-locks=N number of locks per thread [8]
- ##sysbench的 - 測試=線程 - NUM線程= 64 - 測試線程 - 線程收益率= 100 - 螺紋鎖= 6運行
互斥-互斥性能測試
# sysbench --test=mutex help
mutex options:
--mutex-num=N total size of mutex array [4096]
--mutex-locks=N number of mutex locks to do per thread [50000]
--mutex-loops=N number of empty loops to do inside mutex lock [10000]
- #sysbench的 - 測試=互斥 - NUM線程= 64運行
OLTP - OLTP測試
# sysbench --test=oltp help
oltp options:
--oltp-test-mode=STRING test type to use {simple,complex,nontrx,sp} [complex]
--oltp-reconnect-mode=STRING reconnect mode {session,transaction,query,random} [session]
--oltp-sp-name=STRING name of store procedure to call in SP test mode []
--oltp-read-only=[on|off] generate only 'read' queries (do not modify database) [off]
--oltp-skip-trx=[on|off] skip BEGIN/COMMIT statements [off]
--oltp-range-size=N range size for range queries [100]
--oltp-point-selects=N number of point selects [10]
--oltp-simple-ranges=N number of simple ranges [1]
--oltp-sum-ranges=N number of sum ranges [1]
--oltp-order-ranges=N number of ordered ranges [1]
--oltp-distinct-ranges=N number of distinct ranges [1]
--oltp-index-updates=N number of index update [1]
--oltp-non-index-updates=N number of non-index updates [1]
--oltp-nontrx-mode=STRING mode for non-transactional test {select, update_key, update_nokey, insert, delete} [select]
--oltp-auto-inc=[on|off] whether AUTO_INCREMENT (or equivalent) should be used on id column [on]
--oltp-connect-delay=N time in microseconds to sleep after connection to database [10000]
--oltp-user-delay-min=N minimum time in microseconds to sleep after each request [0]
--oltp-user-delay-max=N maximum time in microseconds to sleep after each request [0]
--oltp-table-name=STRING name of test table [sbtest]
--oltp-table-size=N number of records in test table [10000]
--oltp-dist-type=STRING random numbers distribution {uniform,gaussian,special} [special]
--oltp-dist-iter=N number of iterations used for numbers generation [12]
--oltp-dist-pct=N percentage of values to be treated as 'special' (for special distribution) [1]
--oltp-dist-res=N percentage of 'special' values to use (for special distribution) [75]
General database options:
--db-driver=STRING specifies database driver to use ('help' to get list of available drivers)
--db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
Compiled-in database drivers:
mysql - MySQL driver
mysql options:
--mysql-host=[LIST,...] MySQL server host [localhost]
--mysql-port=N MySQL server port [3306]
--mysql-socket=STRING MySQL socket
--mysql-user=STRING MySQL user [sbtest]
--mysql-password=STRING MySQL password []
--mysql-db=STRING MySQL database name [sbtest]
--mysql-table-engine=STRING storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb]
--mysql-engine-trx=STRING whether storage engine used is transactional or not {yes,no,auto} [auto]
--mysql-ssl=[on|off] use SSL connections, if available in the client library [off]
--myisam-max-rows=N max-rows parameter for MyISAM tables [1000000]
--mysql-create-options=STRING additional options passed to CREATE TABLE []
sysbench期望找到sbtest數據庫,所以一定要確保和創造,首先定義你喜歡什麼樣的數據庫。
- sysbench - 測試= OLTP幫助| grep的sbtest
- OLTP表名= STRING測試表名稱[sbtest]
- mysql用戶的= STRING MySQL的用戶[sbtest]
- MYSQL-DB = STRING MySQL數據庫名稱[sbtest]
#sysbench的 - 測試= OLTP - MySQL的主機=本地主機 - MySQL的超級用戶身份 - MySQL的密碼= [<密碼HERE> - mysql的表引擎= InnoDB的準備
#sysbench的mysql的密碼 - 測試= OLTP - MySQL的主機=本地主機 - MySQL的超級用戶身份 - = <password HERE> - mysql的表引擎InnoDB的 - 號線程= 25運行
然後留意你的結果以及數據庫的測試運行。
Apache的基準和| |
WWW ::機械化::火狐
關鍵在這裡帶走的是使用這些工具進行基準測試您的應用程序和過程,不只是一個單一的架構因素。
例如,如果你期望有一個小時20000用戶填寫您的Web表單,那麼你應該基準您的應用程序來處理。 您可以使用上方的工具,模仿的職位只是一個例子,通過令牌,然後測試代碼,在您的應用程序上。 這樣的測試,然後將測試的代碼庫,並與合適的日誌記錄的地方(你也可以打開一個令牌),你可以測試以及開發人員,DBA和系統如何建。
的概念很簡單的例子:
如果你可以打開網址elinks的基準。
elinks http://www.google.com/search?ie=ISO-8859-1\&hl=en\&source=hp\&q=mysql
# ab -n 10 -c 2 http://www.google.com/search?ie=ISO-8859-1\&hl=en\&source=hp\&q=mysql
當然,你會執行此對您的系統在一個更高的水平,以測試應用程序如何響應。