文档

性能白皮书

更新时间:

本文以RDS MySQL间的单向同步实例为例,为您介绍数据传输服务DTS(Data Transmission Service)性能测试的测试环境、测试工具、测试方法与测试结果。

测试环境

数据库信息

说明

测试中使用的RDS MySQL均已开启自动扩容功能。

类别

地域

类型

版本

规格

CPU

内存

源库

华东1(杭州)

高可用系列的RDS MySQL(标准版)

8.0

mysql.x4.xlarge.2c(独享规格)

8

32GB

目标库

测试客户端

说明

需要将ECS实例的IP地址加入到RDS MySQL实例的白名单中。更多信息,请参见设置IP白名单

类型

地域

网络

操作系统

规格

vCPU

内存

是否分配公网IP

ECS实例

华东1(杭州)

专有网络

说明

专有网络VPC和交换机与RDS MySQL相同。

CentOS 7.9 64位

ecs.c7.8xlarge(计算型 c7)

32

64

测试工具

工具介绍

工具

版本

说明

SysBench

1.0.20

一款跨平台且支持多线程的模块化基准测试工具,用于评估系统在运行高负载的数据库时相关核心参数的性能表现,以便快速了解数据库系统的性能。

BenchmarkSQL

5.0(基于Java 8)

一款开源的数据库性能测试工具,主要用于模拟OLTP(在线事务处理)工作负载,对数据库系统的性能进行评估和压力测试。

安装工具

安装Sysbench

  1. 在ECS实例中,下载并安装SysBench。

    # 安装sysbench依赖库
    yum -y install make automake libtool pkgconfig libaio-devel
    yum -y install mariadb-devel openssl-devel
    
    # 下载sysbench源码
    wget "https://codeload.github.com/akopytov/sysbench/zip/refs/tags/1.0.20" -O sysbench-1.0.20.zip
    
    # 安装unzip
    yum -y install unzip
    
    # 解压源码
    unzip sysbench-1.0.20.zip
    
    # 编译源码
    cd sysbench-1.0.20
    ./autogen.sh
    ./configure
    sed -i 's/MYSQL_OPT_COMPRESSION_ALGORITHMS/MYSQL_OPT_COMPRESS/g' ./src/drivers/mysql/drv_mysql.c
    make -j
    
    # 安装
    make install
  2. 准备大表场景(dm_large_table_write_only.lua)、热点数据更新场景(dm_hot_update_only.lua)、DDL同步场景(dm_ddl_only.lua)的Lua脚本文件。

    Lua脚本文件

    dm_large_table_write_only.lua

    #!/usr/bin/env sysbench
    -- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
    
    -- This program is free software; you can redistribute it and/or modify
    -- it under the terms of the GNU General Public License as published by
    -- the Free Software Foundation; either version 2 of the License, or
    -- (at your option) any later version.
    
    -- This program is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -- GNU General Public License for more details.
    
    -- You should have received a copy of the GNU General Public License
    -- along with this program; if not, write to the Free Software
    -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    
    -- ----------------------------------------------------------------------
    -- Large table benchmark for data migration
    -- ----------------------------------------------------------------------
    require("oltp_common")
    
    local function get_table_num()
       return sysbench.rand.uniform(1, sysbench.opt.tables)
    end
    
    local function get_id()
       return sysbench.rand.default(1, sysbench.opt.table_size)
    end
    
    -- Generate large string template, size 1024 * 50
    local function get_large_templete()
       local large_temp = ""
       for i=1,1024 do
          large_temp = large_temp .. "#########-#########-#########-#########-#########-"
       end
       return large_temp
    end
    
    -- Generate large string template, size 1024 * 50
    local large_template = get_large_templete()
    
    -- Generate large value, size 1024 * 50
    local function get_large_value()
       return sysbench.rand.string(large_template)
    end
    
    function large_create_table(drv, con, table_num)
       if drv:name() == "mysql"
       then
          print(string.format("Creating mysql table 'sbtest%d'...", table_num))
       else
          error("Unsupported database driver:" .. drv:name())
       end
    
       query = string.format([[
    CREATE TABLE sbtest%d(
      id int not null auto_increment,
      k INTEGER DEFAULT '0' NOT NULL,
      c longtext,
      pad longtext,
      primary key (id)
    ) ]],table_num)
    
       con:query(query)
    
       if (sysbench.opt.table_size > 0) then
          print(string.format("Inserting %d records into 'sbtest%d'",
                              sysbench.opt.table_size, table_num))
       end
       query = "INSERT INTO sbtest" .. table_num .. "(k, c, pad) VALUES"
       con:bulk_insert_init(query)
    
       for i = 1, sysbench.opt.table_size do
    
          local large_value = get_large_value()
          query = string.format("(%d, '%s', '%s')",
                                   sysbench.rand.default(1, sysbench.opt.table_size),
                                   large_value, large_value)
          con:bulk_insert_next(query)
       end
    
       con:bulk_insert_done()
    
       if sysbench.opt.create_secondary then
          print(string.format("Creating a secondary index on 'sbtest%d'...",
                              table_num))
          con:query(string.format("CREATE INDEX k_%d ON sbtest%d(k)",
                                  table_num, table_num))
       end
    end
    
    
    function execute_delete_inserts_large()
       local tnum = get_table_num()
    
       for i = 1, sysbench.opt.delete_inserts do
          local id = get_id()
          local k = get_id()
    
          param[tnum].deletes[1]:set(id)
    
          param[tnum].inserts[1]:set(id)
          param[tnum].inserts[2]:set(k)
          param[tnum].inserts[3]:set_rand_str(large_template)
          param[tnum].inserts[4]:set_rand_str(large_template)
    
          stmt[tnum].deletes:execute()
          stmt[tnum].inserts:execute()
       end
    end
    
    function execute_non_index_updates_large()
       local tnum = get_table_num()
    
       for i = 1, sysbench.opt.non_index_updates do
          param[tnum].non_index_updates[1]:set_rand_str(large_template)
          param[tnum].non_index_updates[2]:set(get_id())
    
          stmt[tnum].non_index_updates:execute()
       end
    end
    
    local t = sysbench.sql.type
    local stmt_defs = {
       point_selects = {
          "SELECT c FROM sbtest%u WHERE id=?",
          t.INT},
       simple_ranges = {
          "SELECT c FROM sbtest%u WHERE id BETWEEN ? AND ?",
          t.INT, t.INT},
       sum_ranges = {
          "SELECT SUM(k) FROM sbtest%u WHERE id BETWEEN ? AND ?",
           t.INT, t.INT},
       order_ranges = {
          "SELECT c FROM sbtest%u WHERE id BETWEEN ? AND ? ORDER BY c",
           t.INT, t.INT},
       distinct_ranges = {
          "SELECT DISTINCT c FROM sbtest%u WHERE id BETWEEN ? AND ? ORDER BY c",
          t.INT, t.INT},
       index_updates = {
          "UPDATE sbtest%u SET k=k+1 WHERE id=?",
          t.INT},
       non_index_updates = {
          "UPDATE sbtest%u SET c=? WHERE id=?",
          {t.CHAR, 51200}, t.INT},
       deletes = {
          "DELETE FROM sbtest%u WHERE id=?",
          t.INT},
       inserts = {
          "INSERT INTO sbtest%u (id, k, c, pad) VALUES (?, ?, ?, ?)",
          t.INT, t.INT, {t.CHAR, 51200}, {t.CHAR, 51200}},
    }
    
    function prepare_for_each_large_table(key)
       for t = 1, sysbench.opt.tables do
          stmt[t][key] = con:prepare(string.format(stmt_defs[key][1], t))
    
          local nparam = #stmt_defs[key] - 1
    
          if nparam > 0 then
             param[t][key] = {}
          end
    
          for p = 1, nparam do
             local btype = stmt_defs[key][p+1]
             local len
    
             if type(btype) == "table" then
                len = btype[2]
                btype = btype[1]
             end
             if btype == sysbench.sql.type.VARCHAR or
                btype == sysbench.sql.type.CHAR then
                   param[t][key][p] = stmt[t][key]:bind_create(btype, len)
             else
                param[t][key][p] = stmt[t][key]:bind_create(btype)
             end
          end
    
          if nparam > 0 then
             stmt[t][key]:bind_param(unpack(param[t][key]))
          end
       end
    end
    
    -- Overwrite oltp_common create_table function  
    create_table = large_create_table
    
    -- Overwrite oltp_common prepare_for_each_table function  
    prepare_for_each_table = prepare_for_each_large_table
    
    -- Overwrite oltp_common execute_delete_inserts function  
    execute_delete_inserts = execute_delete_inserts_large
    
    -- Overwrite oltp_common execute_non_index_updates function  
    execute_non_index_updates = execute_non_index_updates_large
    
    function prepare_statements()
       if not sysbench.opt.skip_trx then
          prepare_begin()
          prepare_commit()
       end
    
       prepare_index_updates()
       prepare_non_index_updates()
       prepare_delete_inserts()
    end
    
    function event()
       if not sysbench.opt.skip_trx then
          begin()
       end
    
       execute_index_updates()
       execute_non_index_updates()
       execute_delete_inserts()
    
       if not sysbench.opt.skip_trx then
          commit()
       end
    end

    dm_hot_update_only.lua

    #!/usr/bin/env sysbench
    -- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
    
    -- This program is free software; you can redistribute it and/or modify
    -- it under the terms of the GNU General Public License as published by
    -- the Free Software Foundation; either version 2 of the License, or
    -- (at your option) any later version.
    
    -- This program is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -- GNU General Public License for more details.
    
    -- You should have received a copy of the GNU General Public License
    -- along with this program; if not, write to the Free Software
    -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    
    -- ----------------------------------------------------------------------
    -- Hot update benchmark for data migration
    -- ----------------------------------------------------------------------
    require("oltp_common")
    
    function create_hot_update_table(drv, con, table_num)
       local query
       if table_num < 3
       then
          query = string.format([[
             CREATE TABLE IF NOT EXISTS sbtest%d(
               id int not null auto_increment,
               k INTEGER DEFAULT '0' NOT NULL,
               primary key (id)
             )]], table_num)
                con:query(query)
          query = string.format([[
             CREATE PROCEDURE generate_hot_update_sbtest%d (IN id_val int(11), IN update_count int(11) )
             BEGIN
               DECLARE i int default 1;
               INSERT IGNORE INTO sbtest%d (id,k) values(id_val,id_val); 
               WHILE i<=update_count DO
                   UPDATE sbtest%d SET k=k+1 where id=id_val; 
                   SET i = i + 1;
               END WHILE;
             END]], table_num, table_num, table_num)
                con:query(query)
       else
          print(string.format("Ignore create table sbtest%d",table_num))
       end
    end
    
    -- Overwrite oltp_common create_table function  
    create_table = create_hot_update_table
    
    function prepare_statements()
    end
    
    local function get_table_num()
       return sysbench.rand.uniform(1, 2)
    end
    
    local function get_id()
       return sysbench.rand.default(1, 10)
    end
    
    function event()
       local table_id
       local query
       local id_val
    
       id_val = get_id()
    
       table_id = get_table_num()
       query = string.format("CALL generate_hot_update_sbtest%d(%d,10)",table_id, id_val)
       con:query(query)
    end
    

    dm_ddl_only.lua

    #!/usr/bin/env sysbench
    -- Copyright (C) 2006-2017 Alexey Kopytov <akopytov@gmail.com>
    
    -- This program is free software; you can redistribute it and/or modify
    -- it under the terms of the GNU General Public License as published by
    -- the Free Software Foundation; either version 2 of the License, or
    -- (at your option) any later version.
    
    -- This program is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -- GNU General Public License for more details.
    
    -- You should have received a copy of the GNU General Public License
    -- along with this program; if not, write to the Free Software
    -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    
    -- ----------------------------------------------------------------------
    -- DDL benchmark for data migration
    -- ----------------------------------------------------------------------
    require("oltp_common")
    
    function empty_create_table(drv, con, table_num)
       print(string.format("Ignore create table sbtest%d",table_num))
    end
    
    create_table = empty_create_table
    
    function prepare_statements()
    end
    
    local function get_table_num()
       return sysbench.rand.uniform(1, sysbench.opt.tables)
    end
    
    function event()
       local table_id
       local create_query
       local drop_query
    
       table_id = get_table_num()
       create_query = string.format([[
    CREATE TABLE IF NOT EXISTS sbtest%d(
      id int not null auto_increment,
      k INTEGER DEFAULT '0' NOT NULL,
      c CHAR(120) DEFAULT '' NOT NULL,
      pad CHAR(60) DEFAULT '' NOT NULL,
      primary key (id)
    )]],table_id)
       con:query(create_query)
    
       drop_query = string.format("DROP TABLE IF EXISTS sbtest%d",table_id)
       con:query(drop_query)
    end
    
  3. 将三个Lua脚本上传到ECS实例中,并复制到Sysbench脚本目录/usr/local/share/sysbench/中。

    # 复制大表场景脚本
    cp dm_large_table_write_only.lua /usr/local/share/sysbench/
    # 复制热点数据更新场景脚本
    cp dm_hot_update_only.lua /usr/local/share/sysbench/
    # 复制DDL同步场景脚本
    cp dm_ddl_only.lua /usr/local/share/sysbench/

安装BenchmarkSQL

# 安装ant工具
yum -y install ant

# 下载BenchmarkSQL源码
wget "https://github.com/jackysp/benchmarksql/archive/refs/heads/5.0-mysql-support-opt-2.1.zip" -O benchmarksql-5.0-mysql-support-opt-2.1.zip

# 解压源码
unzip benchmarksql-5.0-mysql-support-opt-2.1.zip

# 构建源码
cd benchmarksql-5.0-mysql-support-opt-2.1
ant

测试方法

方法介绍

以下五种测试方法,可以从不同维度测试数据同步的性能。

测试工具

测试模型/脚本

测试功能

Sysbench

oltp_write_only

全量同步、增量同步

dm_large_table_write_only

全量同步、增量同步

dm_hot_update_only

增量同步

dm_ddl_only

增量同步

BenchmarkSQL

TPC-C

全量同步、增量同步

测试步骤

oltp_write_only

  1. 准备基础数据。

    在ECS实例中,通过Sysbench工具为源RDS MySQL实例创建10个表,每个表中导入1000万条数据。

    说明

    需要在/usr/local/share/sysbench/目录下执行如下命令。

    sysbench --db-driver=mysql \
    --mysql-host={HOST} \
    --mysql-port={PORT} \
    --mysql-user= \
    --mysql-password= \
    --mysql-db={DATABASE} \
    --threads=64 --table_size=10000000 --tables=10  oltp_write_only.lua \
    prepare

    参数

    说明

    备注

    相关文档

    --mysql-host

    主机名,此处填入RDS MySQL的内网地址。

    需要替换{HOST}

    查看和管理实例连接地址和端口

    --mysql-port

    端口号,此处填入RDS MySQL的内网端口。

    需要替换{PORT}

    --mysql-user

    数据库账号。

    需要确保数据库账号具有足够的权限。

    创建账号

    --mysql-password

    数据库账号对应的密码。

    --mysql-db

    压测的数据库名称。

    需要提前创建好,并替换{DATABASE}

    管理数据库

    --tables

    数据表的个数。

    本示例取值为10。

    不涉及

    --table_size

    单个数据表中的数据条数。

    本示例取值为10000000。

  2. 创建DTS数据同步实例。

    同步类型需勾选库表结构同步全量同步。更多信息,请参见RDS MySQL实例间的同步

  3. 观察并等待全量同步阶段结束。

  4. 进行增量压测。

    在ECS实例中,使用oltp_write_only模型对DTS同步任务的源库进行压测,以生成Binlog。

    说明

    DML类型的比例为INSERT:UPDATE:DELETE=1:2:1

    sysbench --db-driver=mysql \
    --mysql-host={HOST} \
    --mysql-port={PORT} \
    --mysql-user= \
    --mysql-password= \
    --mysql-db={DATABASE} \
    --threads=64 --table_size=1000000 --tables=10 --time=600 oltp_write_only.lua \
    run

    参数

    说明

    备注

    --time

    压测的时间,单位为秒(s)。

    本示例取值为600。

    --threads

    压测的线程数。

    本示例取值为64。

  5. 在DTS实例的性能监控页面,查看实例的性能。

    更多信息,请参见监控任务性能

dm_large_table_write_only

  1. 准备基础数据。

    在ECS实例中,通过Sysbench工具为源RDS MySQL实例创建10个表,每个表中导入10000条数据。

    说明

    需要在/usr/local/share/sysbench/目录下执行如下命令。

    sysbench --db-driver=mysql \
    --mysql-host={HOST} \
    --mysql-port={PORT} \
    --mysql-user= \
    --mysql-password= \
    --mysql-db={DATABASE} \
    --threads=64 --table_size=10000 --tables=10 dm_large_table_write_only.lua \
    prepare

    参数

    说明

    备注

    相关文档

    --mysql-host

    主机名,此处填入RDS MySQL的内网地址。

    需要替换{HOST}

    查看和管理实例连接地址和端口

    --mysql-port

    端口号,此处填入RDS MySQL的内网端口。

    需要替换{PORT}

    --mysql-user

    数据库账号。

    需要确保数据库账号具有足够的权限。

    创建账号

    --mysql-password

    数据库账号对应的密码。

    --mysql-db

    压测的数据库名称。

    需要提前创建好,并替换{DATABASE}

    管理数据库

    --tables

    数据表的个数。

    本示例取值为10。

    不涉及

    --table_size

    单个数据表中的数据条数。

    本示例取值为10000。

  2. 创建DTS数据同步实例。

    同步类型需勾选库表结构同步全量同步。更多信息,请参见RDS MySQL实例间的同步

  3. 观察并等待全量同步阶段结束。

  4. 进行增量压测。

    在ECS实例中,使用dm_large_table_write_only模型对DTS同步任务的源库进行压测,以生成Binlog。

    sysbench --db-driver=mysql \
    --mysql-host={HOST} \
    --mysql-port={PORT} \
    --mysql-user= \
    --mysql-password= \
    --mysql-db={DATABASE} \
    --threads=64 --table_size=10000 --tables=10 --time=600 dm_large_table_write_only.lua \
    run

    参数

    说明

    备注

    --time

    压测的时间,单位为秒(s)。

    本示例取值为600。

    --threads

    压测的线程数。

    本示例取值为64。

  5. 在DTS实例的性能监控页面,查看实例的性能。

    更多信息,请参见监控任务性能

dm_hot_update_only

  1. 创建DTS数据同步实例。

    同步类型不勾选全量同步。若未在目标RDS MySQL中创建对应的数据库和数据表,则还需勾选库表结构同步。更多信息,请参见RDS MySQL实例间的同步

  2. 初始化压测表数据。

    sysbench --db-driver=mysql \
    --mysql-host={HOST} \
    --mysql-port={PORT} \
    --mysql-user= \
    --mysql-password= \
    --mysql-db={DATABASE} \
    --threads=64 --tables=2 dm_hot_update_only.lua \
    prepare

    参数

    说明

    备注

    相关文档

    --mysql-host

    主机名,此处填入RDS MySQL的内网地址。

    需要替换{HOST}

    查看和管理实例连接地址和端口

    --mysql-port

    端口号,此处填入RDS MySQL的内网端口。

    需要替换{PORT}

    --mysql-user

    数据库账号。

    需要确保数据库账号具有足够的权限。

    创建账号

    --mysql-password

    数据库账号对应的密码。

    --mysql-db

    压测的数据库名称。

    需要提前创建好,并替换{DATABASE}

    管理数据库

    --tables

    数据表的个数。

    本示例取值为2。

    不涉及

  3. 进行增量压测。

    在ECS实例中,使用dm_hot_update_only模型对DTS同步任务的源库进行压测,以生成Binlog。

    sysbench --db-driver=mysql \
    --mysql-host={HOST} \
    --mysql-port={PORT} \
    --mysql-user= \
    --mysql-password= \
    --mysql-db={DATABASE} \
    --threads=64 --tables=2 --time=600 dm_hot_update_only.lua \
    run

    参数

    说明

    备注

    --time

    压测的时间,单位为秒(s)。

    本示例取值为600。

    --threads

    压测的线程数。

    本示例取值为64。

  4. 在DTS实例的性能监控页面,查看实例的性能。

    更多信息,请参见监控任务性能

dm_ddl_only

  1. 创建DTS数据同步实例。

    同步类型不勾选全量同步。若未在目标RDS MySQL中创建对应的数据库和数据表,则还需勾选库表结构同步。更多信息,请参见RDS MySQL实例间的同步

  2. 进行增量压测。

    在ECS实例中,使用dm_ddl_only模型对DTS同步任务的源库进行压测,以生成Binlog。

    sysbench --db-driver=mysql \
    --mysql-host={HOST} \
    --mysql-port={PORT} \
    --mysql-user= \
    --mysql-password= \
    --mysql-db={DATABASE} \
    --threads=64 --tables=2 --time=600 dm_ddl_only.lua \
    run

    参数

    说明

    备注

    相关文档

    --mysql-host

    主机名,此处填入RDS MySQL的内网地址。

    需要替换{HOST}

    查看和管理实例连接地址和端口

    --mysql-port

    端口号,此处填入RDS MySQL的内网端口。

    需要替换{PORT}

    --mysql-user

    数据库账号。

    需要确保数据库账号具有足够的权限。

    创建账号

    --mysql-password

    数据库账号对应的密码。

    --mysql-db

    压测的数据库名称。

    需要提前创建好,并替换{DATABASE}

    管理数据库

    --threads

    压测的线程数。

    本示例取值为64。

    不涉及

    --tables

    数据表的个数。

    本示例取值为2。

    --time

    压测的时间,单位为秒(s)。

    本示例取值为600,持续执行DDL操作600秒。

  3. 在DTS实例的性能监控页面,查看实例的性能。

    更多信息,请参见监控任务性能

TPC-C

  1. 准备基础数据。

    1. 进入ECS实例中BenchmarkSQL的运行目录。

      cd benchmarksql-5.0-mysql-support-opt-2.1/run/
    2. 编译MySQL测试配置文件。

      vim props.mysql

      配置文件如下所示,您需要将{HOST}{PORT}{USER}{PASSWORD}{DATABASE}修改为源RDS MySQL实例的信息。

      db=mysql
      driver=com.mysql.jdbc.Driver
      conn=jdbc:mysql://{HOST}:{PORT}/{DATABASE}?readOnlyPropagatesToServer=false&rewriteBatchedStatements=true&failOverReadOnly=false&connectTimeout=3000&allowMultiQueries=true&clobberStreamingResults=true&characterEncoding=utf8&netTimeoutForStreamingResults=0&autoReconnect=true
      user={USER}
      password={PASSWORD}
      
      warehouses=1000
      loadWorkers=100
      
      terminals=128
      //To run specified transactions per terminal- runMins must equal zero
      runTxnsPerTerminal=0
      //To run for specified minutes- runTxnsPerTerminal must equal zero
      runMins=10
      //Number of total transactions per minute
      limitTxnsPerMin=0
      
      //Set to true to run in 4.x compatible mode. Set to false to use the
      //entire configured database evenly.
      terminalWarehouseFixed=true
      
      //The following five values must add up to 100
      //The default percentages of 45, 43, 4, 4 & 4 match the TPC-C spec
      newOrderWeight=45
      paymentWeight=43
      orderStatusWeight=4
      deliveryWeight=4
      stockLevelWeight=4
      
      // Directory name to create for collecting detailed result data.
      // Comment this out to suppress.
      resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS
      
      // osCollectorScript=./misc/os_collector_linux.py
      // osCollectorInterval=1
      // osCollectorSSHAddr=user@dbhost
      // osCollectorDevices=net_eth0 blk_sda

      参数

      说明

      备注

      conn

      数据库的连接配置。需填入主机名{HOST}、端口号{PORT}

      • HOST:主机名,此处填入RDS MySQL的内网地址。

      • PORT:端口号,此处填入RDS MySQL的内网端口。

      • DATABASE:压测的数据库名称,此处填入RDS MySQL中提前创建好的数据库名称。

      需要替换{HOST}{PORT}{DATABASE}

      user

      数据库账号。

      需要替换{USER}

      password

      数据库账号对应的密码。

      需要替换{PASSWORD}

      runMins

      压测的时间,单位为分钟(min)。

      本示例取值为10。

    3. 初始化TPC-C测试的基础数据。

      ./runDatabaseBuild.sh props.mysql

      将创建10个表,共计大约5亿条数据。

  2. 创建DTS数据同步实例。

    同步类型需勾选库表结构同步全量同步。更多信息,请参见RDS MySQL实例间的同步

  3. 观察并等待全量同步阶段结束。

  4. 进行增量压测。

    在ECS实例中,使用TPC-C模型对DTS同步任务的源库进行压测,以生成Binlog。

    ./runBenchmark.sh props.mysql

    参数

    说明

    备注

    --time

    压测的时间,单位为秒(s)。

    本示例取值为600。

    --threads

    压测的线程数。

    本示例取值为64。

  5. 在DTS实例的性能监控页面,查看实例的性能。

    更多信息,请参见监控任务性能

测试结果

说明

增量同步的最大性能(RPS),请参见数据同步链路规格说明

oltp_write_only

全量同步

实例规格

RPS(Row/s)

BPS(MB/s)

耗时(s)

micro

17.95W

34.19

557

small

18.18W

34.63

550

medium

19.64W

37.42

509

large

19.96W

38.02

501

增量同步

实例规格

RPS(Row/s)

BPS(KB/s)

性能是否已达到规格上限

micro

200

86

small

2000

982

medium

5000

2605

large

11000

5489

dm_large_table_write_only

全量同步

实例规格

RPS(Row/s)

BPS(MB/s)

耗时(s)

micro

469.48

35.09MB

213

small

480.77

35.94MB

208

medium

552.49

41.30MB

181

large

584.80

43.71

171

增量同步

实例规格

RPS(Row/s)

BPS(KB/s)

性能是否已达到规格上限

micro

200

9086.3

small

683

31741.51

medium

1033

56676.41

large

1537

84344.32

dm_hot_update_only

说明

热点合并参数trans.hot.merge.enable默认为false,修改方法请参见修改实例参数

热点合并参数为false

增量同步

实例规格

RPS(Row/s)

性能是否已达到规格上限

micro

200

small

1200

medium

1200

large

1200

热点合并参数为true

增量同步

实例规格

RPS(Row/s)

性能是否已达到规格上限

micro

200

small

2000

medium

5000

large

11000

dm_ddl_only

增量同步

实例规格

RPS(Row/s)

性能是否已达到规格上限

micro

68

small

68

medium

68

large

68

TPC-C

全量同步

实例规格

RPS(Row/s)

BPS(MB/s)

耗时(s)

micro

12.04W

17.52

4143

small

12.09W

17.59

4127

medium

12.73W

18.52

3921

large

13.50W

19.64

3696

增量同步

实例规格

RPS(Row/s

BPS(KB/s)

性能是否已达到规格上限

micro

200

138

small

2000

1920

medium

5000

3847

large

11000

7542

  • 本页导读 (1)
文档反馈