TiDB Sysbench 性能对比测试报告 - v5.0 对比 v4.0

    测试对比 TiDB v5.0 和 v4.0 在 OLTP 场景下的性能。

    软件版本

    服务类型 软件版本
    PD 4.0、5.0
    TiDB 4.0、5.0
    TiKV 4.0、5.0
    Sysbench 1.0.20

    参数配置

    TiDB v4.0 参数配置

    TiKV v4.0 参数配置

    1. raftstore.store-pool-size: 3
    2. rocksdb.max-background-jobs: 3
    3. raftdb.max-background-jobs: 3
    4. raftdb.allow-concurrent-memtable-write: true
    5. server.request-batch-enable-cross-command: false
    6. server.grpc-concurrency: 6
    7. readpool.unified.min-thread-count: 5
    8. readpool.unified.max-thread-count: 20
    9. readpool.storage.normal-concurrency: 10
    10. pessimistic-txn.pipelined: true

    TiDB v5.0 参数配置

    TiKV v5.0 参数配置

    1. storage.scheduler-worker-pool-size: 5
    2. raftstore.store-pool-size: 3
    3. raftstore.apply-pool-size: 3
    4. raftdb.max-background-jobs: 4
    5. raftdb.allow-concurrent-memtable-write: true
    6. server.request-batch-enable-cross-command: false
    7. server.grpc-concurrency: 6
    8. readpool.unified.min-thread-count: 5
    9. readpool.unified.max-thread-count: 20
    10. readpool.storage.normal-concurrency: 10
    11. pessimistic-txn.pipelined: true

    TiDB v4.0 全局变量配置

    TiDB v5.0 全局变量配置

    1. set global tidb_hashagg_partial_concurrency=1;
    2. set global tidb_enable_async_commit = 1;
    3. set global tidb_enable_1pc = 1;
    4. set global tidb_guarantee_linearizability = 0;
    5. set global tidb_enable_clustered_index = 1;
    1. 通过 TiUP 部署 TiDB v5.0 和 v4.0。
    2. 通过 Sysbench 导入 16 张表,每张表有 1000 万行数据。
    3. 分别对每个表执行 命令。
    4. 备份数据,用于不同并发测试前进行数据恢复,以保证每次数据一致。
    5. 启动 Sysbench 客户端,进行 point_selectread_writeupdate_indexupdate_non_index 测试。通过 AWS NLB 向 TiDB 加压,单轮预热 1 分钟,测试 5 分钟。
    6. 每轮完成后停止集群,使用之前的备份的数据覆盖,再启动集群。

    执行以下命令来准备测试数据:

    执行测试命令

    执行以下命令来执行测试:

    1. sysbench $testname \
    2. --threads=$threads \
    3. --time=300 \
    4. --report-interval=1 \
    5. --rand-type=uniform \
    6. --db-driver=mysql \
    7. --mysql-db=sbtest \
    8. --mysql-host=$aws_nlb_host \
    9. --mysql-port=$aws_nlb_port \
    10. run --tables=16 --table-size=10000000

    Point Select 性能

    Threads v4.0 QPS v4.0 95% latency (ms) v5.0 QPS v5.0 95% latency (ms) QPS 提升
    150 17243.78 11.04 30866.23 6.91 79.00%
    300 25397.06 15.83 45915.39 9.73 80.79%
    600 33388.08 25.28 60098.52 16.41 80.00%
    900 38291.75 36.89 70317.41 21.89 83.64%
    1200 41003.46 55.82 76376.22 28.67 86.27%
    1500 44702.84 62.19 80234.58 34.95 79.48%

    v5.0 对比 v4.0,Update Non-index 性能提升了 81%。

    Update Non-index

    Update Index 性能

    Read Write 性能

    Threads v4.0 QPS v4.0 95% latency (ms) v5.0 QPS v5.0 95% latency (ms) QPS 提升
    150 59979.91 61.08 66098.57 55.82 10.20%
    300 77118.32 102.97 84639.48 90.78 9.75%
    600 90619.52 183.21 101477.46 167.44 11.98%
    900 97085.57 267.41 109463.46 240.02 12.75%
    1200 106521.61 331.91 115416.05 320.17 8.35%
    1500 116278.96 363.18 118807.5 411.96 2.17%

    v5.0 对比 v4.0,Read Write 性能提升了 9%。

    Read Write