全部產品
Search
文件中心

Data Transmission Service:效能白皮書

更新時間:Jul 06, 2024

本文以RDS MySQL間的單向同步執行個體為例,為您介紹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(杭州)

專用網路

說明

Virtual Private Cloud和交換器與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

是