Mysql8.0--性能测试对比(sysbench for MGR单主/MGR多主/MHA/Mysql单机)

环境说明:

VMware虚拟机,CentOS Linux release 7.3,所有数据库的buffer_pool都设置为750M,仅限于OLTP事务测试,所有虚拟机节点在同一台物理机上;

MGR单主:mysql 8.0.11,三个节点;

MGR多主:mysql 8.0.11,三个节点;

MHA(开半同步复制):mysql 5.7.19,三个节点;

Mysql单机:mysql 5.7.19,单个节点。

一、数据库准备

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

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

create database sbtest;

二、sysbench配置:

安装依赖、解压、编译等(系统可能自带其他版本sysbench,yum -y remove sysbench 一概卸载了)

yum -y install automake*
yum -y install libtool*
unzip sysbench-0.4.zip
cd sysbench-0.4
./autogen.sh
./configure   
make
make install

三、数据准备与测试流程:

1、准备:(每组测试都要准备,修改IP即可)

测试时间与数据量可以修改max-time参数(单位为秒)、table-size等参数调整;

sysbench --report-interval=1 --num-threads=4 --max-time=600 --test=oltp --mysql-user='sbtest' --mysql-password='sbtest' --oltp-table-size=20000 --mysql-host=192.168.1.11 --mysql-port=3306 --max-requests=10000000 --init-rng=on prepare
2、测试:

所有的测试直接在本地执行(MGR单主模式和MHA是在主库所在节点,MGR多主模式则是任一节点);

sysbench --report-interval=1 --num-threads=4 --max-time=600 --test=oltp --mysql-user='sbtest' --mysql-password='sbtest' --oltp-table-size=20000 --mysql-host=192.168.1.11 --mysql-port=3306 --max-requests=10000000 --init-rng=on run

 

四、测试结果

1、MHA(Mysql5.7半同步)的sysbench测试结果:
OLTP test statistics:
    queries performed:
        read:                            1779806
        write:                           508512
        other:                           254256
        total:                           2542574
    transactions:                        127127 (211.88 per sec.)
    deadlocks:                           2      (0.00 per sec.)
    read/write requests:                 2288318 (3813.82 per sec.)
    other operations:                    254256 (423.76 per sec.)

General statistics:
    total time:                          600.0069s
    total number of events:              127127
    total time taken by event execution: 2399.0217
    response time:
         min:                                  3.65ms
         avg:                                 18.87ms
         max:                               1643.26ms
         approx.  95 percentile:              22.18ms

Threads fairness:
    events (avg/stddev):           31781.7500/26.32
    execution time (avg/stddev):   599.7554/0.00
*****************************************************************************
2、MGR(Mysql8.0)多主测试如下:
OLTP test statistics:
    queries performed:
        read:                            1035734
        write:                           295922
        other:                           147961
        total:                           1479617
    transactions:                        73980  (123.20 per sec.)
    deadlocks:                           1      (0.00 per sec.)
    read/write requests:                 1331656 (2217.71 per sec.)
    other operations:                    147961 (246.41 per sec.)

General statistics:
    total time:                          600.4637s
    total number of events:              73980
    total time taken by event execution: 2401.0029
    response time:
         min:                                  5.30ms
         avg:                                 32.45ms
         max:                               3138.66ms
         approx.  95 percentile:              55.07ms

Threads fairness:
    events (avg/stddev):           18495.0000/1307.88
    execution time (avg/stddev):   600.2507/0.10
    
***********************************************************************************
3、MGR(Mysql8.0)单主测试如下:
OLTP test statistics:
    queries performed:
        read:                            1173480
        write:                           335277
        other:                           167638
        total:                           1676395
    transactions:                        83818  (139.69 per sec.)
    deadlocks:                           2      (0.00 per sec.)
    read/write requests:                 1508757 (2514.54 per sec.)
    other operations:                    167638 (279.39 per sec.)

General statistics:
    total time:                          600.0133s
    total number of events:              83818
    total time taken by event execution: 2399.3494
    response time:
         min:                                  4.64ms
         avg:                                 28.63ms
         max:                               1739.72ms
         approx.  95 percentile:              42.27ms

Threads fairness:
    events (avg/stddev):           20954.5000/80.57
    execution time (avg/stddev):   599.8373/0.00
************************************************************************************
4、MGR(Mysql5.7)单机测试如下:
OLTP test statistics:
    queries performed:
        read:                            2351874
        write:                           671950
        other:                           335972
        total:                           3359796
    transactions:                        167981 (279.97 per sec.)
    deadlocks:                           10     (0.02 per sec.)
    read/write requests:                 3023824 (5039.67 per sec.)
    other operations:                    335972 (559.95 per sec.)

General statistics:
    total time:                          600.0046s
    total number of events:              167981
    total time taken by event execution: 2398.9756
    response time:
         min:                                  3.41ms
         avg:                                 14.28ms
         max:                                662.92ms
         approx.  95 percentile:              19.02ms

Threads fairness:
    events (avg/stddev):           41995.2500/75.64
    execution time (avg/stddev):   599.7439/0.00

***************************************************************************************

粗浅的测试结论:MHA>MGR单主>MGR多主

mysql(mysql 5.7)单机:280TPS(作为比较基准)

MHA(mysql5.7):212TPS

MGR(Mysql8.0)单主:140TPS

MGR(Mysql8.0)多主:123TPS

你可能感兴趣的:(mysql,8.0,MGR,sysbench)