Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxsd committed Aug 21, 2023
2 parents 1fd8eaa + 37a0ac8 commit 2c21891
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 29 deletions.
4 changes: 2 additions & 2 deletions basic-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ aliases: ['/docs-cn/dev/basic-features/','/docs-cn/dev/experimental-features-4.0
| [复合主键](/constraints.md#主键约束) | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| [`CHECK` 约束](/constraints.md#check-约束) | Y | Y | N | N | N | N | N | N | N | N | N |
| [唯一约束](/constraints.md#唯一约束) | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| [整型主键上的聚簇索引](/constraints.md) | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| [复合或非整型主键上的聚簇索引](/constraints.md) | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | N |
| [整型主键上的聚簇索引](/clustered-indexes.md) | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| [复合或非整型主键上的聚簇索引](/clustered-indexes.md) | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | N |
| [多值索引](/sql-statements/sql-statement-create-index.md#多值索引) | Y | Y | Y | N | N | N | N | N | N | N | N |
| [外键约束](/constraints.md#外键约束) | Y | Y | Y | N | N | N | N | N | N | N | N |
| [TiFlash 延迟物化](/tiflash/tiflash-late-materialization.md) | Y | Y | Y | N | N | N | N | N | N | N | N |
Expand Down
2 changes: 1 addition & 1 deletion releases/release-6.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ TiDB 版本:6.1.0

支持通过 `enable-global-kill` 配置项(默认开启)设置全局 kill 开关。

在 TiDB v6.1.0 之前,当某个特定操作占用大量资源引发集群稳定性问题时,你需要先登陆到对应的 TiDB 节点,然后运行 `kill [TiDB] id` 命令终止对应的连接及操作。在 TiDB 节点多的情况下,这种方式使用不便,并且容易误操作。从 v6.1.0 起,当开启 `enable-global-kill` 配置项时,你可以在任意 TiDB 节点运行 kill 命令终止指定的连接及操作,而无需担心客户端和 TiDB 中间有代理时错误地终止其他查询或会话。目前 TiDB 暂时不支持用 Ctrl+C 终止查询或会话。
在 TiDB v6.1.0 之前,当某个特定操作占用大量资源引发集群稳定性问题时,你需要先登录到对应的 TiDB 节点,然后运行 `kill [TiDB] id` 命令终止对应的连接及操作。在 TiDB 节点多的情况下,这种方式使用不便,并且容易误操作。从 v6.1.0 起,当开启 `enable-global-kill` 配置项时,你可以在任意 TiDB 节点运行 kill 命令终止指定的连接及操作,而无需担心客户端和 TiDB 中间有代理时错误地终止其他查询或会话。目前 TiDB 暂时不支持用 Ctrl+C 终止查询或会话。

[用户文档](/tidb-configuration-file.md#enable-global-kill-从-v610-版本开始引入)[#8854](https://github.com/pingcap/tidb/issues/8854)

Expand Down
6 changes: 4 additions & 2 deletions statement-summary-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,18 @@ select * from employee where id in (...) and salary between ? and ?;
statement summary 配置示例如下:

```sql
set global tidb_stmt_summary_max_stmt_count = 3000;
set global tidb_enable_stmt_summary = true;
set global tidb_stmt_summary_refresh_interval = 1800;
set global tidb_stmt_summary_history_size = 24;
```

以上配置生效后,`statements_summary` 每 30 分钟清空一次,所以 `statements_summary_history` 保存最近 12 小时的历史数`statements_summary_evicted` 保存最近 24 个发生了 evict 的时间段记录;`statements_summary_evicted` 则以 30 分钟为一个记录周期,表容量为 24 个时间段。
以上配置生效后,`statements_summary` 每 30 分钟清空一次,`statements_summary_history` 最多保存 3000 种 SQL 种类的数据,每种类型的 SQL 保存最近出现过的 24 个时间段的数据`statements_summary_evicted` 保存最近 24 个发生了 evict 的时间段记录;`statements_summary_evicted` 则以 30 分钟为一个记录周期,表容量为 24 个时间段。

> **注意:**
>
> `tidb_stmt_summary_history_size``tidb_stmt_summary_max_stmt_count``tidb_stmt_summary_max_sql_length` 这些配置都影响内存占用,建议根据实际情况调整(取决于 SQL 大小、SQL 数量、机器配置)不宜设置得过大。内存大小可通过 `tidb_stmt_summary_history_size` \* `tidb_stmt_summary_max_stmt_count` \* `tidb_stmt_summary_max_sql_length` \* `3` 来进行估算。
> - 假设某种 SQL 每分钟都出现,那 `statements_summary_history` 中会保存这种 SQL 最近 12 个小时的数据。但如果某种 SQL 只在每天 00:00 ~ 00:30 出现,则 `statements_summary_history` 中会保存这种 SQL 24 个时间段的数据,每个时间段的间隔都是 1 天,所以会有这种 SQL 最近 24 天的数据。
> - `tidb_stmt_summary_history_size``tidb_stmt_summary_max_stmt_count``tidb_stmt_summary_max_sql_length` 这些配置都影响内存占用,建议根据实际情况调整(取决于 SQL 大小、SQL 数量、机器配置)不宜设置得过大。内存大小可通过 `tidb_stmt_summary_history_size` \* `tidb_stmt_summary_max_stmt_count` \* `tidb_stmt_summary_max_sql_length` \* `3` 来进行估算。
### 为 statement summary 设定合适的大小

Expand Down
24 changes: 3 additions & 21 deletions tidb-lightning/tidb-lightning-physical-import-mode-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ summary: 了解如何使用 TiDB Lightning 的物理导入模式。

本文档介绍如何编写[物理导入模式](/tidb-lightning/tidb-lightning-physical-import-mode.md) 的配置文件,如何进行性能调优、使用磁盘资源配额等内容。

使用物理导入模式有一些限制,使用前请务必阅读[必要条件及限制](/tidb-lightning/tidb-lightning-physical-import-mode.md#必要条件及限制)

## 配置及使用

可以通过以下配置文件使用物理导入模式执行数据导入:
Expand Down Expand Up @@ -193,28 +195,8 @@ store-write-bwlimit = "128MiB"
[tidb]
# 使用更小的并发以降低计算 checksum 和执行 analyze 对事务延迟的影响。
distsql-scan-concurrency = 3

[cron]
# 避免将 TiKV 切换到 import 模式。
switch-mode = '0'
```

在测试中用 TPCC 测试模拟在线业务,同时用 TiDB Lightning 向 TiDB 集群导入数据,测试导入数据对 TPCC 测试结果的影响。测试结果如下:

| 线程数 | TPM | P99 | P90 | AVG |
| ----- | --- | --- | --- | --- |
| 1 | 20%~30% | 60%~80% | 30%~50% | 30%~40% |
| 8 | 15%~25% | 70%~80% | 35%~45% | 20%~35% |
| 16 | 20%~25% | 55%~85% | 35%~40% | 20%~30% |
| 64 | 无显著影响 |
| 256 | 无显著影响 |

表格中的百分比含义为 TiDB Lightning 导入对 TPCC 结果的影响大小。对于 TPM,数值表示 TPM 下降的百分比;对于延迟 P99、P90、AVG,数值表示延迟上升的百分比。

测试结果表明,TPCC 并发越小,TiDB Lightning 导入对 TPCC 结果影响越大。当 TPCC 并发达到 64 或以上时,Lightning 导入对 TPCC 结果无显著影响。

因此,如果你的 TiDB 生产集群上有延迟敏感型业务,并且并发较小,**强烈建议**不使用 TiDB Lightning 导入数据到该集群,这会给在线业务带来较大影响。

## 性能调优

**提高 Lightning 物理导入模式导入性能最直接有效的方法:**
Expand All @@ -224,7 +206,7 @@ switch-mode = '0'

当然,Lightning 也提供了部分并发相关配置以影响物理导入模式的导入性能。但是从长期实践的经验总结来看,以下四个配置项一般保持默认值即可,调整其数值并不会带来显著的性能提升,可作为了解内容阅读。

```
```toml
[lightning]
# 引擎文件的最大并行数。
# 每张表被切分成一个用于存储索引的“索引引擎”和若干存储行数据的“数据引擎”。
Expand Down
4 changes: 3 additions & 1 deletion tidb-lightning/tidb-lightning-physical-import-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ backend = "local"

- 请勿直接使用物理导入模式向已经投入生产的 TiDB 集群导入数据,这将对在线业务产生严重影响。如需向生产集群导入数据,请参考[导入时限制调度范围从集群降低到表级别](/tidb-lightning/tidb-lightning-physical-import-mode-usage.md#导入时暂停-pd-调度的范围)

- 如果你的 TiDB 生产集群上有延迟敏感型业务,并且并发较小,**不建议**使用 TiDB Lightning 物理导入模式导入数据到该集群,因为可能会影响在线业务。

- 默认情况下,不应同时启动多个 TiDB Lightning 实例向同一 TiDB 集群导入数据,而应考虑使用[并行导入](/tidb-lightning/tidb-lightning-distributed-import.md)特性。

- 使用多个 TiDB Lightning 向同一目标导入时,请勿混用不同的 backend,即不可同时使用物理导入模式和逻辑导入模式导入同一 TiDB 集群。

- 在导入数据的过程中,请勿在目标表进行 DDL 和 DML 操作,否则会导致导入失败或数据不一致。导入期间也不建议进行读操作,因为读取的数据可能不一致。请在导入操作完成后再进行读写操作。

- 单个 Lightning 进程导入单表不应超过 10 TB。使用并行导入时,Lightning 实例不应超过 10 个。
- 单个 TiDB Lightning 进程导入单表不应超过 10 TB。使用并行导入时,TiDB Lightning 实例不应超过 10 个。

### 与其他组件一同使用的注意事项

Expand Down
2 changes: 1 addition & 1 deletion tiunimanager/tiunimanager-manage-host-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ summary: 如何通过 TiUniManager 管理主机资源。
> - 你需要按照主机模板完整、正确地填写字段信息。详情参见本节中[主机模板字段说明](#主机模板字段说明)
> - 导入主机时,TiDB 会对主机进行检查,参见 [TiDB 环境与系统配置检查](/check-before-deployment.md)
TiUniManager 中控机通过 SSH 连接主机,默认连接端口为 `22`。如果环境中 SSH 端口不为默认的 `22`,可通过 OpenAPI 修改 `config_default_ssh_port` 参数来配置主机的默认登陆端口,该参数默认值为 `22`。以下示例通过 OpenAPI 修改 `config_default_ssh_port` 参数的值,从而修改主机的默认登陆端口
TiUniManager 中控机通过 SSH 连接主机,默认连接端口为 `22`。如果环境中 SSH 端口不为默认的 `22`,可通过 OpenAPI 修改 `config_default_ssh_port` 参数来配置主机的默认登录端口,该参数默认值为 `22`。以下示例通过 OpenAPI 修改 `config_default_ssh_port` 参数的值,从而修改主机的默认登录端口

1. 登录 TiUniManager 获取用户 Token。

Expand Down
2 changes: 1 addition & 1 deletion tiunimanager/tiunimanager-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ summary: 了解如何快速使用 TiUniManager 进行集群操作。
> - 你需要按照主机模板完整、正确地填写字段信息。详情参见本节中[主机模板字段说明](#主机模板字段说明)
> - 导入主机时,TiDB 会对主机进行检查,参见 [TiDB 环境与系统配置检查](/check-before-deployment.md)
TiUniManager 中控机通过 SSH 连接主机,默认连接端口为 `22`。如果环境中 SSH 端口不为默认的 `22`,可通过 OpenAPI 修改 `config_default_ssh_port` 参数来配置主机的默认登陆端口,该参数默认值为 `22`。以下示例通过 OpenAPI 修改 `config_default_ssh_port` 参数的值,从而修改主机的默认登陆端口
TiUniManager 中控机通过 SSH 连接主机,默认连接端口为 `22`。如果环境中 SSH 端口不为默认的 `22`,可通过 OpenAPI 修改 `config_default_ssh_port` 参数来配置主机的默认登录端口,该参数默认值为 `22`。以下示例通过 OpenAPI 修改 `config_default_ssh_port` 参数的值,从而修改主机的默认登录端口

1. 登录 TiUniManager 获取用户 Token。

Expand Down

0 comments on commit 2c21891

Please sign in to comment.