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

歡迎訪問 生活随笔!

生活随笔

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

数据库

mysql benchmark基准测试

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

git項目地址:

https://github.com/akopytov/sysbench

利用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

centos上如果用yum install sysbench安裝的話,運行時可能會出現

FATAL: no database driver specified
FATAL: failed to initialize database driver!

可以加上參數?--db-driver=mysql ,原因是yum方式安裝時,同時安裝了mysql與其它數據庫的驅動,不指定驅動類型的話,sysbench不知道你是要測試是mysql,還是oracle之類的其它數據庫

  ?

四、運行測試

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 benchmarkNo DB drivers specified, using mysql Running the test with following options: Number of threads: 1Doing 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: 140000write: 50000other: 20000total: 210000transactions: 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.4371stotal number of events: 10000total time taken by event execution: 19.3581per-request statistics:min: 1.65msavg: 1.94msmax: 13.48msapprox. 95 percentile: 2.34msThreads fairness:events (avg/stddev): 10000.0000/0.00execution 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即可。 

?

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

轉載于:https://www.cnblogs.com/yjmyzz/p/mysql-benchmark-use-sysbench.html

總結

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

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