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

    软件版本

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

    参数配置

    TiDB v3.0 参数配置

    TiKV v3.0 参数配置

    1. raftstore.store-pool-size: 3
    2. raftstore.apply-pool-size: 3
    3. rocksdb.max-background-jobs: 3
    4. raftdb.max-background-jobs: 3
    5. raftdb.allow-concurrent-memtable-write: true
    6. server.grpc-concurrency: 6
    7. readpool.storage.normal-concurrency: 10
    8. readpool.coprocessor.normal-concurrency: 5

    TiDB v4.0 参数配置

    TiKV v4.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: 3
    5. raftdb.allow-concurrent-memtable-write: true
    6. server.request-batch-enable-cross-command: false
    7. server.grpc-concurrency: 6
    8. readpool.unified.max-thread-count: 20
    9. readpool.storage.normal-concurrency: 10
    10. pessimistic-txn.pipelined: true

    全局变量配置

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

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

    1. sysbench oltp_common \
    2. --threads=16 \
    3. --rand-type=uniform \
    4. --db-driver=mysql \
    5. --mysql-db=sbtest \
    6. --mysql-host=$aws_nlb_host \
    7. --mysql-port=$aws_nlb_port \
    8. --mysql-user=root \
    9. prepare --tables=16 --table-size=10000000

    执行测试命令

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

    Point Select 性能

    Threads v3.0 QPS v3.0 95% latency (ms) v4.0 QPS v4.0 95% latency (ms) QPS 提升
    150 15446.41024 11.446 16954.39971 10.844 9.76%
    300 22276.15572 17.319 24364.44689 16.706 9.37%
    600 28784.88353 29.194 31635.70833 28.162 9.90%
    900 32194.15548 42.611 35787.66078 38.942 11.16%
    1200 33954.69114 58.923 38552.63158 51.018 13.54%
    1500 35412.0032 74.464 40859.63755 62.193 15.38%

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

    Update Index 性能

    v4.0 对比 v3.0,Update Index 性能提升了 17%。

    Update Index

    Read Write 性能

    Threads v3.0 QPS v3.0 95% latency (ms) v4.0 QPS v4.0 95% latency (ms) QPS 提升
    150 43768.33633 71.83 53912.63705 59.993 23.18%
    300 55655.63589 121.085 71327.21336 97.555 28.16%
    600 64642.96992 223.344 84487.75483 176.731 30.70%
    900 68947.25293 325.984 90177.94612 257.95 30.79%
    1200 71334.80099 434.829 92779.71507 344.078 30.06%
    1500 72069.9115 580.017 95088.50812 434.829 31.94%