Mysql常用基準(zhǔn)測(cè)試命令總結(jié)
mysqlslap
常用參數(shù)說(shuō)明
- –auto-generate-sql 由系統(tǒng)自動(dòng)生成sql腳本進(jìn)行測(cè)試
- –auto-generate-sql-add-autoincrement 在生成的表中增加自增ID
- –auto-generate-sql-load-type 指定測(cè)試中使用的查詢(xún)類(lèi)型
- –auto-generate-sql-write-number 制定初始化數(shù)據(jù)時(shí)生成的數(shù)據(jù)量
- –concurrency 指定并發(fā)線程的數(shù)量
- –engine 指定要測(cè)試表的存儲(chǔ)引擎,逗號(hào)分隔多個(gè)
- –no-drop 不清理測(cè)試數(shù)據(jù)(一般不設(shè)置)
- –iterations 指定測(cè)試運(yùn)行的次數(shù)
- –number-of-queries 指定每一個(gè)線程執(zhí)行的查詢(xún)數(shù)量
- –debug-info 指定輸出額外的內(nèi)存及cpu統(tǒng)計(jì)信息
- –number-int-cols 指定測(cè)試表中包含的int類(lèi)型列的數(shù)量
- –number-char-cols指定測(cè)試表中包含的varchar類(lèi)型數(shù)量
- –create-schema 指定用于執(zhí)行測(cè)試的數(shù)據(jù)庫(kù)名字
- –query 用于指定自定義sql的腳本
- –only-print 并不運(yùn)行測(cè)試腳本,而是把生產(chǎn)的腳本打印出來(lái)
mysqlslap --concurrency=1,50,100,200 --iterations=3 --number-int-cols=5 --number-char-cols=5 --auto-generate-sql --auto-generate-sql-add-autoincrement --engine=myisam,innodb --number-of-queries=10 --create-schema=sbtest
sysbench
安裝說(shuō)明
# 下載https://gihub.com/akopytov/sysbench/archive/0.5.zip# 解壓unzip sysbench-0.5zip
cd sysbench
./autogen.sh# 配置自己的mysql include 和 lib目錄./configure --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/lib/
make && make install
常用參數(shù)
–test 用于指定索要執(zhí)行的測(cè)試類(lèi)型 支持一下參數(shù)
Fileio 文件系統(tǒng)I/O性能測(cè)試
cpu cpu性能測(cè)試
memory 內(nèi)存性能測(cè)試
- –mysql-db 用于指定執(zhí)行基準(zhǔn)測(cè)試的數(shù)據(jù)庫(kù)名
- –mysql-table-engine 用于指定所使用的存儲(chǔ)引擎
- –oltp-tables-count 執(zhí)行測(cè)試的表數(shù)量
- –oltp-table-size 指定每個(gè)表中的數(shù)據(jù)行數(shù)
- –num-threads 制定測(cè)試的并發(fā)線程數(shù)量
- –max-time 指定測(cè)試最大時(shí)間 s
- –report-interval 指定間隔多長(zhǎng)時(shí)間輸出一次統(tǒng)計(jì)信息
- –mysql-user 指定執(zhí)行測(cè)試的mysql用戶(hù)
- –mysql-password 密碼
prepare 用于準(zhǔn)備測(cè)試數(shù)據(jù)
run 運(yùn)行測(cè)試
cleanup 清除測(cè)試數(shù)據(jù)
# 對(duì)cpu進(jìn)行測(cè)試sysbench --test=cpu --cpu-max-prime=10000 run# 磁盤(pán)I/O測(cè)試 首先準(zhǔn)備數(shù)據(jù)要大于內(nèi)存sysbench --test=Fileio --file-total-size=1Gpreparesysbench --test=Fileio --num--threads=8 --init-rgn=on -file-total-size=1G --file-test-mode=rndrw --report-interval=1# 數(shù)據(jù)庫(kù)性能測(cè)試 建立基準(zhǔn)測(cè)試的用戶(hù)密碼數(shù)據(jù),然后進(jìn)入sysbench的test目錄下,利用lua腳本測(cè)試sysbench --test=./oltp.lua --mysql-table-engine=innodb --oltp-table-size=10000 --mysql-db=db_name --mysql-user=user_name --mysql-password=password --oltp-tables-count=10 --mysql-socket=/usr/local/mysql/data/mysql.sock prepare# 開(kāi)始測(cè)試,將上述命令的prepare改為run
mysqlslap
常用參數(shù)說(shuō)明
- –auto-generate-sql 由系統(tǒng)自動(dòng)生成sql腳本進(jìn)行測(cè)試
- –auto-generate-sql-add-autoincrement 在生成的表中增加自增ID
- –auto-generate-sql-load-type 指定測(cè)試中使用的查詢(xún)類(lèi)型
- –auto-generate-sql-write-number 制定初始化數(shù)據(jù)時(shí)生成的數(shù)據(jù)量
- –concurrency 指定并發(fā)線程的數(shù)量
- –engine 指定要測(cè)試表的存儲(chǔ)引擎,逗號(hào)分隔多個(gè)
- –no-drop 不清理測(cè)試數(shù)據(jù)(一般不設(shè)置)
- –iterations 指定測(cè)試運(yùn)行的次數(shù)
- –number-of-queries 指定每一個(gè)線程執(zhí)行的查詢(xún)數(shù)量
- –debug-info 指定輸出額外的內(nèi)存及cpu統(tǒng)計(jì)信息
- –number-int-cols 指定測(cè)試表中包含的int類(lèi)型列的數(shù)量
- –number-char-cols指定測(cè)試表中包含的varchar類(lèi)型數(shù)量
- –create-schema 指定用于執(zhí)行測(cè)試的數(shù)據(jù)庫(kù)名字
- –query 用于指定自定義sql的腳本
- –only-print 并不運(yùn)行測(cè)試腳本,而是把生產(chǎn)的腳本打印出來(lái)
mysqlslap --concurrency=1,50,100,200 --iterations=3 --number-int-cols=5 --number-char-cols=5 --auto-generate-sql --auto-generate-sql-add-autoincrement --engine=myisam,innodb --number-of-queries=10 --create-schema=sbtest
sysbench
安裝說(shuō)明
# 下載https://gihub.com/akopytov/sysbench/archive/0.5.zip# 解壓unzip sysbench-0.5zip
cd sysbench
./autogen.sh# 配置自己的mysql include 和 lib目錄./configure --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/lib/
make && make install
常用參數(shù)
–test 用于指定索要執(zhí)行的測(cè)試類(lèi)型 支持一下參數(shù)
Fileio 文件系統(tǒng)I/O性能測(cè)試
cpu cpu性能測(cè)試
memory 內(nèi)存性能測(cè)試
- –mysql-db 用于指定執(zhí)行基準(zhǔn)測(cè)試的數(shù)據(jù)庫(kù)名
- –mysql-table-engine 用于指定所使用的存儲(chǔ)引擎
- –oltp-tables-count 執(zhí)行測(cè)試的表數(shù)量
- –oltp-table-size 指定每個(gè)表中的數(shù)據(jù)行數(shù)
- –num-threads 制定測(cè)試的并發(fā)線程數(shù)量
- –max-time 指定測(cè)試最大時(shí)間 s
- –report-interval 指定間隔多長(zhǎng)時(shí)間輸出一次統(tǒng)計(jì)信息
- –mysql-user 指定執(zhí)行測(cè)試的mysql用戶(hù)
- –mysql-password 密碼
prepare 用于準(zhǔn)備測(cè)試數(shù)據(jù)
run 運(yùn)行測(cè)試
cleanup 清除測(cè)試數(shù)據(jù)
# 對(duì)cpu進(jìn)行測(cè)試sysbench --test=cpu --cpu-max-prime=10000 run# 磁盤(pán)I/O測(cè)試 首先準(zhǔn)備數(shù)據(jù)要大于內(nèi)存sysbench --test=Fileio --file-total-size=1Gpreparesysbench --test=Fileio --num--threads=8 --init-rgn=on -file-total-size=1G --file-test-mode=rndrw --report-interval=1# 數(shù)據(jù)庫(kù)性能測(cè)試 建立基準(zhǔn)測(cè)試的用戶(hù)密碼數(shù)據(jù),然后進(jìn)入sysbench的test目錄下,利用lua腳本測(cè)試sysbench --test=./oltp.lua --mysql-table-engine=innodb --oltp-table-size=10000 --mysql-db=db_name --mysql-user=user_name --mysql-password=password --oltp-tables-count=10 --mysql-socket=/usr/local/mysql/data/mysql.sock prepare# 開(kāi)始測(cè)試,將上述命令的prepare改為run
以上就是本次分享的全部?jī)?nèi)容,感謝大家對(duì)腳本之家的支持。
相關(guān)文章
mysql database manual(mysql數(shù)據(jù)庫(kù)手冊(cè))
mysql database manual(mysql數(shù)據(jù)庫(kù)手冊(cè)),使用mysql的朋友可以參考下。2011-09-09
解決Mysql 8.0.17 winx64版本安裝過(guò)程中遇到的問(wèn)題
這篇文章主要介紹了Mysql 8.0.17 winx64版本安裝過(guò)程中遇到的問(wèn)題 ,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-08-08
關(guān)于mysql調(diào)用新手們常犯的11個(gè)錯(cuò)誤總結(jié)
對(duì)于很多新手們來(lái)說(shuō),使用PHP可以在短短幾個(gè)小時(shí)之內(nèi)輕松地寫(xiě)出具有特定功能的代碼。但是,構(gòu)建一個(gè)穩(wěn)定可靠的數(shù)據(jù)庫(kù)卻需要花上一些時(shí)日和相關(guān)技能。下面這篇文章就來(lái)總結(jié)了關(guān)于mysql調(diào)用新手們常犯的十一個(gè)錯(cuò)誤,需要的朋友可以參考學(xué)習(xí)。2017-03-03
my.cnf(my.ini)重要參數(shù)優(yōu)化配置說(shuō)明
本文針對(duì)mysql不同存儲(chǔ)引擎,MyISAM與Innodb進(jìn)行了講解如何進(jìn)行my.cnf(my.ini)的參數(shù)優(yōu)化2018-03-03
與MSSQL對(duì)比學(xué)習(xí)MYSQL的心得(五)--運(yùn)算符
MYSQL中的運(yùn)算符很多,這一節(jié)主要講MYSQL中有的,而SQLSERVER沒(méi)有的運(yùn)算符2014-06-06
MySQL使用正則表達(dá)式去檢索指定數(shù)據(jù)庫(kù)字段
這篇文章主要介紹了MySQL使用正則表達(dá)式去檢索指定數(shù)據(jù)庫(kù)字段,文章圍繞主題展開(kāi)詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下2022-09-09

