亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL 5.7和8.0 MHA架構下sysbench壓測

發布時間:2020-08-10 22:26:03 來源:ITPUB博客 閱讀:220 作者:18141908802 欄目:MySQL數據庫

轉轉連接   http://blog.itpub.net/22996654/viewspace-2655331/

sysbench壓測環境:

sysbench server:172.16.7.105

壓測數據庫服務器:MHA架構,172.16.7.100(主節點)、172.16.7.101、172.16.7.102

MySQL在172.16.7.105(安裝MySQL5.7.26)部署目錄:/opt/mysql/

主要壓測172.16.7.100主節點

172.16.7.100配置:

MySQL5.7.26

CPU:4核

內存:8G

innodb_buffer_pool_size = 28G

innodb_log_file_size = 512M

innodb_log_files_in_group = 2

innodb_log_buffer_size=16M

MySQL8.0.17

CPU:4核

內存:8G

innodb_buffer_pool_size = 28G

innodb_log_file_size = 512M

innodb_log_files_in_group = 2

innodb_log_buffer_size=16M

前置工作

1.完成MySQL的安裝

2.完成動態庫文件的安裝

yum install -y openssl libtool 

#可能遇到的報錯

1.在make之前,需要修改lib庫,否則會得到一個報錯:/usr/bin/ld: cannot find -lmysqlclient_r

因為安裝中指向的lib是/opt/mysql/lib

cd /opt/mysql/lib

ln -s libmysqlclient.so.20.3.9 libmysqlclient_r.so

2.make的時候沒有明顯錯誤,執行./sysbench時報錯

./sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

ln -s /opt/mysql/lib/libmysqlclient.so.18 /usr/lib64

如果報錯為

/usr/local/sysbench/bin/sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

那么就執行

ln -s /opt/mysql/lib/libmysqlclient.so.20 /usr/lib64

下載sysbench:

wget http://imysql.com/wp-content/uploads/2014/09/sysbench-0.4.12-1.1.tgz

部署:

tar -xf sysbench-0.4.12-1.1.tgz

mv sysbench-0.4.12-1.1 sysbench

cp -r sysbench /usr/local/sysbench

cd /usr/local/sysbench

./autogen.sh

#生成configure文件

./configure --prefix=/usr/local/sysbench/  --with-mysql=/opt/mysql/  --with-mysql-includes=/opt/mysql/include/ --with-mysql-libs=/opt/mysql/lib/

注意此處的includes必須是mysql對應的include目錄,libs也是mysql對應的lib目錄

完成安裝

make&&make install

(確認沒有報錯)

驗證安裝

/usr/local/sysbench/bin/sysbench --help

如果出現下列文字,說明部署成功

[root@GTID01 bin]# /usr/local/sysbench/bin/sysbench --help

Missing required command argument.Usage: sysbench [general-options]... --test= [test-options]... command

General options:

  --num-threads=N            number of threads to use [1]

  --max-requests=N            limit for total number of requests [10000]

...

增加環境變量

echo -e "export PATH=\$PATH:/usr/local/sysbench/bin" >> /etc/profile

source /etc/profile

使用sysbench進行測試

先到被測試的庫里建庫,建用戶,授權(這里通過105去測試100庫)

mysql -h 172.16.7.100 -uroot -p

...

create database sbtest; ##因為lua腳本里面這里設置的就是sbtest庫,庫名需要與腳本里的內容保持一致

create user tpcc@'%' identified by 'tpcc';

grant all privileges on sbtest.* to tpcc@'%';

flush privileges;

MySQL8.0需要加:

alter user tpcc@'%' identified with 'mysql_native_password' by 'tpcc';

會產生報錯的操作(將oltp.lua中的mysiam修改成innodb后,會找不到表)

cd /usr/local/sysbench/sysbench/tests/db/

cp oltp.lua oltp_innodb.lua

sed -i 's/myisam/innodb/g' /usr/local/sysbench/sysbench/tests/db/oltp_innodb.lua

測試多表的壓測

執行prepare

sysbench --mysql-host=172.16.7.100 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc --test=/usr/local/sysbench/sysbench/tests/db/oltp.lua --oltp_tables_count=10 --oltp-table-size=100000 --rand-init=on prepare

執行run

sysbench --mysql-host=172.16.7.100 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc --test=/usr/local/sysbench/sysbench/tests/db/oltp.lua --oltp_tables_count=10 --oltp-table-size=100000 --num-threads=4 --oltp-read---report-interval=5 --rand-type=uniform --max-time=30 --max-requests=0 --percentile=99 run

--num-threads=4    //線程數為4

--max-time=30      //測試時間為30s

--report-interval=5    //報告打印周期為5s

--oltp-read->

--max-requests=0                //最大執行次數這里不做限制,只由max-time進行限制

MySQL8.0我是用的30001端口

MySQL5.7用32線程壓測結果:

sysbench 0.5:  multi-threaded system evaluation benchmark

Running the test with following options:

Number of threads: 32

Report intermediate results every 5 second(s)

Random number generator seed is 0 and will be ignored

Threads started!

[   5s] threads: 32, tps: 842.19, reads/s: 11867.59, writes/s: 3376.34, response time: 172.23ms (99%)

[  10s] threads: 32, tps: 1013.21, reads/s: 14187.90, writes/s: 4053.03, response time: 96.36ms (99%)

[  15s] threads: 32, tps: 1195.60, reads/s: 16709.15, writes/s: 4778.79, response time: 63.71ms (99%)

[  20s] threads: 32, tps: 1095.19, reads/s: 15341.21, writes/s: 4383.35, response time: 87.04ms (99%)

[  25s] threads: 32, tps: 1111.01, reads/s: 15567.40, writes/s: 4446.26, response time: 78.19ms (99%)

[  30s] threads: 32, tps: 1045.20, reads/s: 14628.00, writes/s: 4174.40, response time: 85.90ms (99%)

OLTP test statistics:

    queries performed:

        read:                            441616

        write:                           126176

        other:                           63088

        total:                           630880

    transactions:                        31544  (1050.71 per sec.)

    deadlocks:                           0      (0.00 per sec.)

    read/write requests:                 567792 (18912.78 per sec.)

    other operations:                    63088  (2101.42 per sec.)

General statistics:

    total time:                          30.0216s

    total number of events:              31544

    total time taken by event execution: 954.2759s

    response time:

         min:                                  9.17ms

         avg:                                 30.25ms

         max:                                389.96ms

         approx.  99 percentile:              94.36ms

Threads fairness:

    events (avg/stddev):           985.7500/40.24

    execution time (avg/stddev):   29.8211/0.03

read: 441616     //讀總數,select語句

write: 126176    //寫總數,insert、delete、update語句

other: 63088    //其它語句,如commit等

total: 630880           //總的執行語句數

transactions: 31544 (1050.71 per sec.)  //總的事物數(★每秒處理事物數:TPS★)

read/write requests: 567792 (18912.78 per sec.)  //讀寫請求次數(★每秒的讀寫次數:QPS★)

other operations: 63088 (2101.42 per sec.)    //其它操作的每秒執行數

General statistics:

total time: 30.0216s        //總時間

total number of events: 

31544    //★事物總數★

total time taken by event execution: 954.2759s   //所有事務耗時相加(不考慮并行因素)

response time:    //應答時間

min: 9.17ms    //最小

avg: 30.25ms    //平均

max: 389.96ms    //最大

approx. 99 percentile: 94.36ms  //99%語句執行時間

Threads fairness:  //線程公平性

events (avg/stddev): 985.7500/40.24

execution time (avg/stddev): 29.8211/0.03

需要重點關注的幾個測試結果

★總的事物數,每秒事務數TPS,QPS,時間統計信息(最大、最小、平均、99%以上語句響應時間)★

通過sysbench結果來判定數據庫的能力主要還是通過TPS

執行清除

sysbench --mysql-host=172.16.7.100 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc --mysql-db=sbtest --oltp-tables-count=10 --oltp-table-size=100000 --num-threads=16 --max-requests=0 --max-time=30 --report-interval=1 --test=/usr/local/sysbench/sysbench/tests/db/oltp.lua cleanup

sysbench 0.5: multi-threaded system evaluation benchmark

Dropping table 'sbtest1'...

Dropping table 'sbtest2'...

Dropping table 'sbtest3'...

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

本溪市| 尼勒克县| 包头市| 安新县| 镇平县| 桐柏县| 遵化市| 环江| 英山县| 交城县| 白玉县| 龙游县| 镇原县| 无极县| 舒城县| 璧山县| 时尚| 凌源市| 江源县| 富阳市| 孟州市| 都安| 呈贡县| 裕民县| 喜德县| 阳西县| 监利县| 五大连池市| 富蕴县| 大冶市| 郎溪县| 定兴县| 永福县| 黄浦区| 四会市| 大石桥市| 江北区| 邵阳县| 和田县| 浦江县| 卢氏县|