Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
+ 性能测试报告及重现指南
+ [如何用 Sysbench 测试 TiDB](/benchmark/benchmark-tidb-using-sysbench.md)
+ [如何对 TiDB 进行 TPC-C 测试](/benchmark/benchmark-tidb-using-tpcc.md)
+ [Sysbench 性能对比 - v4.0 对比 v3.0](/benchmark/benchmark-sysbench-v4-vs-v3.md)
+ [TPC-H 性能对比 - v4.0 对比 v3.0](/benchmark/v4.0-performance-benchmarking-with-tpch.md)
+ [TPC-C 性能对比 - v4.0 对比 v3.0](/benchmark/v4.0-performance-benchmarking-with-tpcc.md)
+ [Sysbench 性能对比 - v3.0 对比 v2.1](/benchmark/v3.0-performance-benchmarking-with-sysbench.md)
+ [TPC-C 性能对比 - v3.0 对比 v2.1](/benchmark/v3.0-performance-benchmarking-with-tpcc.md)
+ [线上负载与 ADD INDEX 相互影响测试](/benchmark/online-workloads-and-add-index-operations.md)
+ 数据迁移
+ [支持的数据迁移路径](/data-migration-route.md)
Expand Down
169 changes: 100 additions & 69 deletions benchmark/benchmark-sysbench-v4-vs-v3.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: TiDB Sysbench 性能对比测试报告 - v4.0 对比 v3.0
category: benchmark
draft: true
---

# TiDB Sysbench 性能对比测试报告 - v4.0 对比 v3.0
Expand All @@ -14,7 +13,7 @@ draft: true

### 硬件配置

| 服务类型 | EC2 类型 | 节点数 |
| 服务类型 | EC2 类型 | 节点数 |
|:----------|:----------|:----------|
| PD | m5.xlarge | 3 |
| TiKV | i3.4xlarge| 3 |
Expand All @@ -23,7 +22,7 @@ draft: true

### 软件版本

| 服务类型 | 软件版本
| 服务类型 | 软件版本 |
|:----------|:-----------|
| PD | 3.0、4.0 |
| TiDB | 3.0、4.0 |
Expand All @@ -32,65 +31,88 @@ draft: true

### 参数配置

#### TiDB 3.0 参数配置

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

#### TiKV 3.0 参数配置

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

#### TiDB 4.0 参数配置

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

#### TiKV 4.0 参数配置

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

#### 全局变量

- set global tidb_hashagg_final_concurrency=1;
- set global tidb_hashagg_partial_concurrency=1;
- set global tidb_disable_txn_auto_retry=0;
#### TiDB v3.0 参数配置

{{< copyable "" >}}

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

#### TiKV v3.0 参数配置

{{< copyable "" >}}

```yaml
storage.scheduler-worker-pool-size: 5
raftstore.store-pool-size: 3
raftstore.apply-pool-size: 3
rocksdb.max-background-jobs: 3
raftdb.max-background-jobs: 3
raftdb.allow-concurrent-memtable-write: true
server.grpc-concurrency: 6
readpool.storage.normal-concurrency: 10
readpool.coprocessor.normal-concurrency: 5
```

#### TiDB v4.0 参数配置

{{< copyable "" >}}

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

#### TiKV v4.0 参数配置

{{< copyable "" >}}

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

#### 全局变量配置

{{< copyable "sql" >}}

```sql
set global tidb_hashagg_final_concurrency=1;
set global tidb_hashagg_partial_concurrency=1;
set global tidb_disable_txn_auto_retry=0;
```

## 测试方案

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

### 准备数据命令

{{< copyable "shell-regular" >}}

```bash
sysbench oltp_common \
--threads=16 \
--rand-type=uniform \
Expand All @@ -101,9 +123,13 @@ sysbench oltp_common \
--mysql-user=root \
--mysql-password=password \
prepare --tables=16 --table-size=10000000

```

### 执行测试命令

{{< copyable "shell-regular" >}}

```bash
sysbench $testname \
--threads=$threads \
--time=300 \
Expand All @@ -114,25 +140,30 @@ sysbench $testname \
--mysql-host=$aws_nlb_host \
--mysql-port=$aws_nlb_port \
run --tables=16 --table-size=10000000
```

## 测试结果

### Point Select
### Point Select 性能

v4.0 对比 v3.0,Point Select 性能提升了 14%。

![Point Select](/media/sysbench_v4vsv3_point_select.png)

### Update Non-index 性能

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

TODO
<!-- TODO ![Point Select](/media/sysbench_v4vsv3_point_select.png) -->
![Update Non-index](/media/sysbench_v4vsv3_update_non_index.png)

### Update Non-index
### Update Index 性能

TODO
<!-- TODO ![Update Non-index](/media/sysbench_v4vsv3_update_non_index.png)-->
v4.0 对比 v3.0,Update Index 性能提升了 17%。

### Update Index
![Update Index](/media/sysbench_v4vsv3_update_index.png)

TODO
<!-- TODO ![Update Index](/media/sysbench_v4vsv3_update_index.png)-->
### Read Write 性能

### Read Write
v4.0 对比 v3.0,Read Write 性能提升了 31%。

TODO
<!-- ![Read Write](/media/sysbench_v4vsv3_read_write.png)-->
![Read Write](/media/sysbench_v4vsv3_read_write.png)
Loading