共計 3865 個字符,預計需要花費 10 分鐘才能閱讀完成。
自動寫代碼機器人,免費開通
丸趣 TV 小編給大家分享一下 Mysql 常用基準測試工具是什么,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
mysqlslap 常用參數說明
–auto-generate-sql 由系統自動生成 sql 腳本進行測試
–auto-generate-sql-add-autoincrement 在生成的表中增加自增 ID
–auto-generate-sql-load-type 指定測試中使用的查詢類型
–auto-generate-sql-write-number 制定初始化數據時生成的數據量
–concurrency 指定并發線程的數量
–engine 指定要測試表的存儲引擎,逗號分隔多個
–no-drop 不清理測試數據(一般不設置)
–iterations 指定測試運行的次數
–number-of-queries 指定每一個線程執行的查詢數量
–debug-info 指定輸出額外的內存及 cpu 統計信息
–number-int-cols 指定測試表中包含的 int 類型列的數量
–number-char-cols 指定測試表中包含的 varchar 類型數量
–create-schema 指定用于執行測試的數據庫名字
–query 用于指定自定義 sql 的腳本
–only-print 并不運行測試腳本,而是把生產的腳本打印出來
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 安裝說明
# 下載 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
常用參數
–test 用于指定索要執行的測試類型 支持一下參數
Fileio 文件系統 I / O 性能測試
cpu cpu 性能測試
memory 內存性能測試
–mysql-db 用于指定執行基準測試的數據庫名
–mysql-table-engine 用于指定所使用的存儲引擎
–oltp-tables-count 執行測試的表數量
–oltp-table-size 指定每個表中的數據行數
–num-threads 制定測試的并發線程數量
–max-time 指定測試最大時間 s
–report-interval 指定間隔多長時間輸出一次統計信息
–mysql-user 指定執行測試的 mysql 用戶
–mysql-password 密碼
prepare 用于準備測試數據
run 運行測試
cleanup 清除測試數據
# 對 cpu 進行測試 sysbench --test=cpu --cpu-max-prime=10000 run# 磁盤 I / O 測試 首先準備數據要大于內存 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# 數據庫性能測試 建立基準測試的用戶密碼數據, 然后進入 sysbench 的 test 目錄下,利用 lua 腳本測試 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# 開始測試,將上述命令的 prepare 改為 run
mysqlslap 常用參數說明
–auto-generate-sql 由系統自動生成 sql 腳本進行測試
–auto-generate-sql-add-autoincrement 在生成的表中增加自增 ID
–auto-generate-sql-load-type 指定測試中使用的查詢類型
–auto-generate-sql-write-number 制定初始化數據時生成的數據量
–concurrency 指定并發線程的數量
–engine 指定要測試表的存儲引擎,逗號分隔多個
–no-drop 不清理測試數據(一般不設置)
–iterations 指定測試運行的次數
–number-of-queries 指定每一個線程執行的查詢數量
–debug-info 指定輸出額外的內存及 cpu 統計信息
–number-int-cols 指定測試表中包含的 int 類型列的數量
–number-char-cols 指定測試表中包含的 varchar 類型數量
–create-schema 指定用于執行測試的數據庫名字
–query 用于指定自定義 sql 的腳本
–only-print 并不運行測試腳本,而是把生產的腳本打印出來
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 安裝說明
# 下載 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
常用參數
–test 用于指定索要執行的測試類型 支持一下參數
Fileio 文件系統 I / O 性能測試
cpu cpu 性能測試
memory 內存性能測試
–mysql-db 用于指定執行基準測試的數據庫名
–mysql-table-engine 用于指定所使用的存儲引擎
–oltp-tables-count 執行測試的表數量
–oltp-table-size 指定每個表中的數據行數
–num-threads 制定測試的并發線程數量
–max-time 指定測試最大時間 s
–report-interval 指定間隔多長時間輸出一次統計信息
–mysql-user 指定執行測試的 mysql 用戶
–mysql-password 密碼
prepare 用于準備測試數據
run 運行測試
cleanup 清除測試數據
# 對 cpu 進行測試 sysbench --test=cpu --cpu-max-prime=10000 run# 磁盤 I / O 測試 首先準備數據要大于內存 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# 數據庫性能測試 建立基準測試的用戶密碼數據, 然后進入 sysbench 的 test 目錄下,利用 lua 腳本測試 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# 開始測試,將上述命令的 prepare 改為 run
看完了這篇文章,相信你對“Mysql 常用基準測試工具是什么”有了一定的了解,如果想了解更多相關知識,歡迎關注丸趣 TV 行業資訊頻道,感謝各位的閱讀!
向 AI 問一下細節