日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql benchmark 测试工具_mysql benchmark基准测试

發布時間:2023/12/8 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql benchmark 测试工具_mysql benchmark基准测试 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

git項目地址:

利用sysbench很容易對mysql做性能基準測試(當然這個工具很強大,除了測試主流數據庫性能,還能測試其它方面,詳情自己看官網項目文檔)

mac上的用法:

一、安裝

brew install sysbench

二、先在mysql上創建一個專門的測試數據庫,比如test

三、利用sysbench先生成測試數據

sysbench --test=oltp --oltp-table-size=5000000 --oltp-table-name=t_test --mysql-table-engine=innodb --mysql-host=localhost --mysql-db=test --mysql-user=root --mysql-password=*** prepare

上面這一堆的意思,是在本機localhost的test數據庫的t_test中創建500萬條測試數據,表的數據庫引擎為innodb.

tips:如果想知道還有哪些參數可用,可輸入命令

sysbench --test=oltp help

四、運行測試

sysbench --test=oltp --oltp-table-size=5000000 --oltp-table-name=t_test --mysql-table-engine=innodb --mysql-host=localhost --mysql-db=test --mysql-user=root --mysql-password=*** run

最后一個prepare改成run就行了,測試完后,會輸出類似以下結果:

sysbench 0.4.12: multi-threaded system evaluation benchmark

No DB drivers specified, using mysql

Running the test with following options:

Number of threads: 1

Doing OLTP test.

Running mixed OLTP test

Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)

Using "BEGIN" for starting transactions

Using auto_inc on the id column

Maximum number of requests for OLTP test is limited to 10000

Threads started!

Done.

OLTP test statistics:

queries performed:

read: 140000

write: 50000

other: 20000

total: 210000

transactions: 10000 (514.48 per sec.)

deadlocks: 0 (0.00 per sec.)

read/write requests: 190000 (9775.14 per sec.)

other operations: 20000 (1028.96 per sec.)

Test execution summary:

total time: 19.4371s

total number of events: 10000

total time taken by event execution: 19.3581

per-request statistics:

min: 1.65ms

avg: 1.94ms

max: 13.48ms

approx. 95 percentile: 2.34ms

Threads fairness:

events (avg/stddev): 10000.0000/0.00

execution time (avg/stddev): 19.3581/0.00

一般我們比較關心:

transactions: 10000 (514.48 per sec.)

read/write requests: 190000 (9775.14 per sec.)

這代表每秒能處理的事務數,以及每秒的讀寫次數。

五、清理測試數據

sysbench --test=oltp --oltp-table-size=5000000 --oltp-table-name=t_test --mysql-table-engine=innodb --mysql-host=localhost --mysql-db=test --mysql-user=root --mysql-password=*** cleanup

最后一個換成cleanup即可。

春晚實在太無聊了,還不如寫二行代碼有意思,祝各位園友猴年大吉,身體健康,心想事成!

原文:http://www.cnblogs.com/yjmyzz/p/mysql-benchmark-use-sysbench.html

總結

以上是生活随笔為你收集整理的mysql benchmark 测试工具_mysql benchmark基准测试的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。