mysql高性能学习笔记03_MySQL高性能学习笔记
一、Ubuntu 安裝mysql
我們在Ubuntu情況下裝一個測試用的MySQL來進修。
1.更新包sudo?apt-getupdate
2.安裝MySQL的辦事端和客戶端
在安裝的過程中,須要輸入數據庫暗碼。
3.啟動Mysqlsudo?service?mysql?restart
4.登錄mysqlmysql?-u?root?-p
二、sysbench基準測試
sysbench是一個開源的、模塊化的、跨平臺的多線程機能測試對象,可以用來進行CPU、內存、磁盤I/O、線程、數據庫的機能測試。今朝支撐的數據庫有MySQL、Oracle和PostgreSQL。當前功能許可測試的體系參數有:
scheduler performance (調劑機能)
memory allocation and transfer speed (內存分派和傳輸速度)
POSIX threads implementation performance (POSIX線程履行績效)
database server performance (OLTP benchmark) (數據庫辦事器機能)
1.安裝apt-get?install?sysbench
在安裝的時刻出現了如許的缺點:Could not get lock /var/lib/dpkg/lock
出現這個問題可能是有別的一個法度榜樣正在運行,導致資本被鎖弗采取。而導致資本被鎖的原因可能是前次運行安裝或更新時沒有正常完成,進而出現此狀況,解決的辦法其實很簡單:
在終端中敲入以下兩句sudo?rm?/var/cache/apt/archives/lock
sudo?rm?/var/lib/dpkg/lock
再試著安裝,問題解決。
2.通悠揭捉?項解釋root@db2:~#?sysbench
Missing?required?command?argument.
Usage: #應用辦法sysbench?[general-options]...--test=?[test-options]...?command
General options: #通悠揭捉?項
--num-threads=N number of threads to use [1] #創建測試線程的數量。默認為1.
--max-requests=N limit for total number of requests [10000] #請求的最大年夜數量。默認為10000,0代表不限制。
--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off] #跨越max-time強迫中斷。默認是off。
--thread-stack-size=SIZE size of stack per thread [32K] #每個線程的客棧大年夜小。默認是32K。
--init-rng=[on|off] initialize random number generator [off] #在測試開端時是否初始化隨機數產生器。默認是off。
file I/O performance (文件I / O機能)
--test=STRING test to run #指定測試項目名稱。
--debug=[on|off] print more debugging info [off] #是否顯示更多的調試信息。默認是off。
--validate=[on|off] perform validation checks where possible [off] #在可能情況下履行驗證檢查。默認是off。
--help=[on|off] print help and exit #贊助信息。
--version=[on|off] print version and exit #版本信息。
Compiled-in tests: #測試項目
fileio - File I/O test #IO
cpu - CPU performance test #CPU
memory - Memory functions speed test #內存
--oltp-sp-name=STRING 存儲過程的名稱。默認為空
threads - Threads subsystem performance test #線程
mutex - Mutex performance test #互斥機能測試
oltp - OLTP test # 數據庫,事務處理
Commands: prepare:測試前預備工作; run:正式測試 cleanup:測試后刪掉落測試數據 help version
清除運行文件:
See 'sysbench --test= help' for a list of options for each test. #查看每個測試項目標更多選項列表
更多選項:
1):sysbench --test=fileio helproot@db2:~#?sysbench--test=fileio?help
sysbench?0.4.12:?multi-threaded?system?evaluation?benchmark
fileio options:
--file-num=N 創建測試文件的數量。默認是128
--file-block-size=N 測試時文件塊的大年夜小。默認是16384(16K)
--file-total-size=SIZE 測試文件的總大年夜小。默認是2G
--file-test-mode=STRING 文件測試模式{seqwr(次序寫), seqrewr(次序讀寫), seqrd(次序讀), rndrd(隨機讀), rndwr(隨機寫), rndrw(隨機讀寫)}
--file-io-mode=STRING 文件操作模式{sync(同步),async(異步),fastmmap(快速map映射),slowmmap(慢map映射)}。默認是sync
--file-extra-flags=STRING 應用額外的標記來打開文件{sync,dsync,direct} 。默認為空
--file-fsync-freq=N 履行fsync()的頻率。(0 – 不應用fsync())。默認是100
推薦閱讀
室外持續高溫,王金升正舒暢地在空調房享受著這一消暑時刻,忽然他放在桌子上的手機“滴滴”地響了起來,他經由過程簡單的操作,就完成了自家地里的舉措措施大年夜棚的┞菲握。>>>詳細閱讀
地址:http://www.17bianji.com/lsqh/36585.html
總結
以上是生活随笔為你收集整理的mysql高性能学习笔记03_MySQL高性能学习笔记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql字符集相关问题_MySQL 字
- 下一篇: mysql子查询缺点_[慢查优化]慎用M