TiDB Sysbench 性能对比测试报告 - v5.2.0 对比 v5.1.1

测试概况

本次测试对比了 TiDB v5.2.0 和 v5.1.1 在 OLTP 场景下的 Sysbench 性能表现。结果显示,v5.2.0 相比于 v5.1.1,Point Select 场景性能提升了 11.03%,其余场景性能略有下降。

测试环境 (AWS EC2)

硬件配置

服务类型EC2 类型实例数
PDm5.xlarge3
TiKVi3.4xlarge3
TiDBc5.4xlarge3
Sysbenchc5.9xlarge1

软件版本

服务类型软件版本
PDv5.1.1、v5.2.0
TiDBv5.1.1、v5.2.0
TiKVv5.1.1、v5.2.0
Sysbench1.1.0-ead2689

参数配置

两个版本使用相同的配置

TiDB 参数配置

log.level: "error"
performance.max-procs: 20
prepared-plan-cache.enabled: true
tikv-client.max-batch-wait-time: 2000000

TiKV 参数配置

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

TiDB 全局变量配置

set global tidb_hashagg_final_concurrency=1;
set global tidb_hashagg_partial_concurrency=1;
set global tidb_enable_async_commit = 1;
set global tidb_enable_1pc = 1;
set global tidb_guarantee_linearizability = 0;
set global tidb_enable_clustered_index = 1; 

测试方案

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

准备测试数据

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

sysbench oltp_common \
    --threads=16 \
    --rand-type=uniform \
    --db-driver=mysql \
    --mysql-db=sbtest \
    --mysql-host=$aws_nlb_host \
    --mysql-port=$aws_nlb_port \
    --mysql-user=root \
    --mysql-password=password \
    prepare --tables=16 --table-size=10000000

执行测试命令

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

sysbench $testname \
    --threads=$threads \
    --time=300 \
    --report-interval=1 \
    --rand-type=uniform \
    --db-driver=mysql \
    --mysql-db=sbtest \
    --mysql-host=$aws_nlb_host \
    --mysql-port=$aws_nlb_port \
    run --tables=16 --table-size=10000000

测试结果

Point Select 性能

Threadsv5.1.1 QPSv5.1.1 95% latency (ms)v5.2.0 QPSv5.2.0 95% latency (ms)QPS 提升
150143014.132.35174402.51.2321.95%
300199133.063.682720181.6436.60%
600389391.652.18393536.42.111.06%
900468338.822.97447981.983.3-4.35%
1200448348.525.18468241.294.654.44%
1500454376.797.04483888.426.096.49%

v5.2.0 对比 v5.1.1,Point Select 性能提升了 11.03%。

Point Select

Update Non-index 性能

Threadsv5.1.1 QPSv5.1.1 95% latency (ms)v5.2.0 QPSv5.2.0 95% latency (ms)QPS 提升
15031198.686.4330714.736.09-1.55%
30043577.1510.4642997.929.73-1.33%
60057230.1817.3256168.8116.71-1.85%
90065325.1123.164098.0422.69-1.88%
120071528.2628.6769908.1528.67-2.26%
150076652.533.1274371.7933.72-2.98%

v5.2.0 对比 v5.1.1,Update Non-index 性能下降了 1.98%。

Update Non-index

Update Index 性能

Threadsv5.1.1 QPSv5.1.1 95% latency (ms)v5.2.0 QPSv5.2.0 95% latency (ms)QPS 提升
15015641.0413.221532013.46-2.05%
30019787.7321.8919161.3522.69-3.17%
60024566.7436.8923616.0738.94-3.87%
90027516.5750.1126270.0454.83-4.53%
120029421.1063.3228002.6569.29-4.82%
150030957.8477.1928624.4495.81-7.54%

v5.2.0 对比 v5.1.1,Update Index 性能下降了 4.33%。

Update Index

Read Write 性能

Threadsv5.1.1 QPSv5.1.1 95% latency (ms)v5.2.0 QPSv5.2.0 95% latency (ms)QPS 提升
15068471.0257.876924654.831.13%
30086573.0997.5585340.4294.10-1.42%
600101760.75176.73102221.31173.580.45%
900111877.55248.83109276.45257.95-2.32%
1200117479.4337.94114231.33344.08-2.76%
1500119662.91419.45116663.28434.83-2.51%

v5.2.0 对比 v5.1.1,Read Write 性能下降了 1.24%。

Read Write

下载 PDF
产品
TiDB
TiDB Cloud
© 2023 PingCAP. All Rights Reserved.