Skip to content
Open
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
15 changes: 12 additions & 3 deletions ticdc/ticdc-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The new architecture supports **table-level task splitting** for all sinks. You
When this feature is enabled, TiCDC automatically splits and distributes tables across multiple nodes for parallel replication if those tables meet any of the following conditions. This improves replication efficiency and resource utilization:

- The table Region count exceeds the configured threshold (`10000` by default, adjustable via `scheduler.region-threshold`).
- The table write traffic exceeds the configured threshold (disabled by default, configurable via `scheduler.write-key-threshold`).
- The table sink DML event throughput exceeds the configured threshold (disabled by default, configurable via `scheduler.write-key-threshold`, measured in bytes per second).

> **Note:**
>
Expand All @@ -74,7 +74,9 @@ In table split mode, pay attention to the following settings:

- [`scheduler.region-threshold`](/ticdc/ticdc-changefeed-config.md#region-threshold): the default value is `10000`. When the number of Regions in a table exceeds this threshold, TiCDC splits the table. For tables with relatively few Regions but high overall write throughput, you can reduce this value appropriately. This parameter must be greater than or equal to `scheduler.region-count-per-span`. Otherwise, tasks might be rescheduled repeatedly, which increases replication latency.
- [`scheduler.region-count-per-span`](/ticdc/ticdc-changefeed-config.md#region-count-per-span-new-in-v854): the default value is `100`. During changefeed initialization, TiCDC splits tables that meet the split conditions according to this parameter. After splitting, each sub-table contains at most `region-count-per-span` Regions.
- [`scheduler.write-key-threshold`](/ticdc/ticdc-changefeed-config.md#write-key-threshold): the default value is `0` (disabled). When the sink write throughput of a table exceeds this threshold, TiCDC triggers table splitting. In most cases, keep this parameter at `0`.
- [`scheduler.write-key-threshold`](/ticdc/ticdc-changefeed-config.md#write-key-threshold): sets the threshold for splitting table replication tasks based on the write traffic of a table. The default value is `0`, which disables splitting table replication tasks based on write traffic. The write traffic of a table is calculated from the estimated size of DML events that the sink has finished writing, measured in bytes per second. In most cases, keep this parameter at `0`.
- When `scheduler.enable-table-across-nodes = true`, if you set `scheduler.write-key-threshold` to a positive value smaller than `10485760`, TiCDC automatically adjusts it to `10485760`, using 10 MiB/s as the write traffic threshold.
- When `scheduler.enable-table-across-nodes = true`, if you set `scheduler.write-key-threshold` to a value greater than or equal to `10485760`, TiCDC uses the configured value as the write traffic threshold.

## Compatibility

Expand Down Expand Up @@ -109,7 +111,14 @@ In the TiCDC classic architecture, DDL replication operations are strictly seria

## Limitations

The new TiCDC architecture currently does not support splitting large transactions into multiple batches for downstream replication. As a result, there is still a risk of OOM when processing extremely large transactions. Make sure to evaluate and mitigate this risk appropriately before using the new architecture.
The new TiCDC architecture incorporates all functionalities of the classic architecture. However, some features have not yet been fully tested. To ensure system stability, it is **NOT** recommended to use the following features in core production environments:

- [Syncpoint](/ticdc/ticdc-upstream-downstream-check.md)
- [Redo Log](/ticdc/ticdc-sink-to-mysql.md#eventually-consistent-replication-in-disaster-scenarios)
- [Pulsar Sink](/ticdc/ticdc-sink-to-pulsar.md)
- [Storage Sink](/ticdc/ticdc-sink-to-cloud-storage.md)

In addition, the new TiCDC architecture currently does not support splitting large transactions into multiple batches for downstream replication. As a result, there is still a risk of OOM when processing extremely large transactions. Make sure to evaluate and mitigate this risk appropriately before using the new architecture.

## Upgrade guide

Expand Down
11 changes: 8 additions & 3 deletions ticdc/ticdc-changefeed-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ For more information, see [Event filter rules](/ticdc/ticdc-filter.md#event-filt
- When `enable-table-across-nodes` is enabled, there are two allocation modes:

1. Allocate tables based on the number of Regions, so that each TiCDC node handles roughly the same number of Regions. If the number of Regions for a table exceeds the value of [`region-threshold`](#region-threshold), the table will be allocated to multiple nodes for replication.
2. Allocate tables based on the write traffic, so that each TiCDC node handles roughly the same number of modified rows. Only when the number of modified rows per minute in a table exceeds the value of [`write-key-threshold`](#write-key-threshold), will this allocation take effect.
2. Allocate tables based on the write traffic, so that each TiCDC node handles a similar amount of write load. In the [TiCDC classic architecture](/ticdc/ticdc-classic-architecture.md), this mode uses the upstream PD Region `written_keys` statistics. In the [TiCDC new architecture](/ticdc/ticdc-architecture.md), this mode uses the sink DML event size per second. Only when a table's write traffic exceeds the value of [`write-key-threshold`](#write-key-threshold), will this allocation take effect.

You only need to configure one of the two modes. If both `region-threshold` and `write-key-threshold` are configured, TiCDC prioritizes the traffic allocation mode, namely `write-key-threshold`.

Expand All @@ -174,17 +174,22 @@ For more information, see [Event filter rules](/ticdc/ticdc-filter.md#event-filt

#### `write-key-threshold`

- Default value: `0`, which means that the traffic allocation mode is not used by default
- Default value: `0`, which disables splitting table replication tasks based on write traffic.
- In the [TiCDC new architecture](/ticdc/ticdc-architecture.md), this parameter sets the threshold for splitting table replication tasks based on the write traffic of a table. The write traffic of a table is calculated from the estimated size of DML events that the sink has finished writing, measured in bytes per second. In most cases, keep this parameter at `0`.
- When `scheduler.enable-table-across-nodes = true`, if you set `scheduler.write-key-threshold` to a positive value smaller than `10485760`, TiCDC automatically adjusts it to `10485760`, using 10 MiB/s as the write traffic threshold.
- When `scheduler.enable-table-across-nodes = true`, if you set `scheduler.write-key-threshold` to a value greater than or equal to `10485760`, TiCDC uses the configured value as the write traffic threshold.
- In the [TiCDC classic architecture](/ticdc/ticdc-classic-architecture.md), this value is the threshold for the upstream PD Region `written_keys` statistics used by classic table splitting.

### sink

<!-- MQ sink configuration items -->

#### `dispatchers`

- When the changefeed downstream is an MQ sink, you can use `dispatchers` to configure event dispatchers. Starting from v8.5.7, for the [new TiCDC architecture](/ticdc/ticdc-architecture.md), you can also use `dispatchers` to configure table routing, mapping upstream tables to specific downstream database or table names. For more information, see [TiCDC table routing](/ticdc/ticdc-table-routing.md).
- For the sink of MQ type, you can use dispatchers to configure the event dispatcher.
- Starting from v6.1.0, TiDB supports two types of event dispatchers: partition and topic.
- The matching syntax of matcher is the same as the filter rule syntax.
- This configuration item only takes effect if the downstream is MQ.
- When the downstream MQ is Pulsar, if the routing rule for `partition` is not specified as any of `ts`, `index-value`, `table`, or `default`, each Pulsar message will be routed using the string you set as the key. For example, if you specify the routing rule for a matcher as the string `code`, then all Pulsar messages that match that matcher will be routed with `code` as the key.

#### `column-selectors` <span class="version-mark">New in v7.5.0</span>
Expand Down
14 changes: 8 additions & 6 deletions ticdc/ticdc-sink-to-kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ column-selectors = [

## Scale out the load of a single large table to multiple TiCDC nodes

This feature splits the data replication range of a single large table into multiple ranges, according to the data volume and the number of modified rows per minute, and it makes the data volume and the number of modified rows replicated in each range approximately the same. This feature distributes these ranges to multiple TiCDC nodes for replication, so that multiple TiCDC nodes can replicate a large single table at the same time. This feature can solve the following two problems:
This feature splits the data replication range of a single large table into multiple ranges and distributes them to multiple TiCDC nodes for parallel replication. When this feature is enabled, TiCDC can split the replication range based on the number of Regions in the table. When `write-key-threshold` is greater than `0`, TiCDC can also split the replication range based on write traffic. In the TiCDC classic architecture, `write-key-threshold` uses the upstream PD Region `written_keys` statistics. In the TiCDC new architecture, `write-key-threshold` uses sink DML event bytes per second. This feature can solve the following two problems:

- A single TiCDC node cannot replicate a large single table in time.
- The resources (such as CPU and memory) consumed by TiCDC nodes are not evenly distributed.
Expand All @@ -370,14 +370,16 @@ enable-table-across-nodes = true
# When you enable this feature, it only takes effect for tables with the number of regions greater than the `region-threshold` value. For the TiCDC new architecture, the default value is `10000`; for the TiCDC classic architecture, the default value is `100000`.

region-threshold = 10000
# When you enable this feature, it takes effect for tables with the number of rows modified per minute greater than the `write-key-threshold` value.
# When you enable this feature, it takes effect for tables whose write traffic exceeds the `write-key-threshold` value.
# Note:
# * The default value of `write-key-threshold` is 0, which means that the feature does not split the table replication range according to the number of rows modified in a table by default.
# * You can configure this parameter according to your cluster workload. For example, if it is configured as 30000, it means that the feature will split the replication range of a table when the number of modified rows per minute in the table exceeds 30000.
# * The default value of `write-key-threshold` is 0, which disables traffic-based table splitting by default.
# * In the TiCDC classic architecture, `write-key-threshold` uses the upstream PD Region `written_keys` statistics.
# * In the TiCDC new architecture, `write-key-threshold` is measured in sink DML event bytes per second. If you set a positive value smaller than 10485760 (10 MiB), TiCDC automatically adjusts it to 10485760, so do not reuse classic-architecture values directly.
# * In the TiCDC new architecture, 10485760 (10 MiB) is the smallest positive value that takes effect without adjustment.
# * When `region-threshold` and `write-key-threshold` are configured at the same time:
# TiCDC will check whether the number of modified rows is greater than `write-key-threshold` first.
# TiCDC will check whether the write traffic is greater than `write-key-threshold` first.
# If not, next check whether the number of Regions is greater than `region-threshold`.
write-key-threshold = 30000
write-key-threshold = 10485760

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

git diff --no-ext-diff 1e852511d8a7994ebdeb3641b5462d4844434016 0775fe4fb5e3c135c77ffb7f6077aabbfeedc12c -- ticdc/ticdc-sink-to-kafka.md
printf '\n--- current section ---\n'
sed -n '340,392p' ticdc/ticdc-sink-to-kafka.md

Repository: pingcap/docs

Length of output: 7192


Mark the sample threshold as new-architecture-specific.

The page also covers classic TiCDC, where write-key-threshold uses PD Region written_keys. Direct classic users to choose a threshold based on that statistic.

Suggested fix
-write-key-threshold = 10485760
+write-key-threshold = 10485760 # Example for the new architecture; choose a classic value based on PD Region written_keys.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
write-key-threshold = 10485760
write-key-threshold = 10485760 # Example for the new architecture; choose a classic value based on PD Region written_keys.

```

You can query the number of Regions a table contains by the following SQL statement:
Expand Down