The synchronization speed of DM is very slow, and it takes a long time to catch up with a few versions. Is it a TiDB issue or a DM issue?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: dm同步速度很慢,同步很长时间才追了几个版本,是tidb问题还是dm问题

| username: Jjjjayson_zeng

【TiDB Usage Environment】Production Environment / Testing / PoC
【TiDB Version】
【Reproduction Path】What operations were performed when the issue occurred
【Encountered Issue: Issue Symptoms and Impact】
【Resource Configuration】
【Attachments: Screenshots / Logs / Monitoring】

| username: weixiaobing | Original post link

You can check the write latency of the downstream database to see if the bottleneck is in TiDB. Or look at the following parameters:

syncers:                             # Configuration parameters for the sync processing unit
  global:                            # Configuration name
    worker-count: 16                 # Number of concurrent threads for applying binlog that has been transferred to the local, default is 16. Adjusting this parameter will not affect the concurrency of upstream log fetching but will put significant pressure on the downstream.
    batch: 100                       # Number of SQL statements in a transaction batch migrated to the downstream database, default is 100, generally recommended not to exceed 500.

Do these parameters need adjustment?

| username: Jjjjayson_zeng | Original post link

Where can I see the write latency?

| username: Jjjjayson_zeng | Original post link

The image you provided is not visible. Please provide the text content that you need translated.

| username: weixiaobing | Original post link

If DM has sufficient resources, you can increase the worker-count and batch size.

| username: Jjjjayson_zeng | Original post link

Isn’t 6 and 100 enough? Do you still need a lot more?

| username: magic | Original post link

Post the DM monitoring metrics and take a look at “Remaining time to sync” and “Replication lag” first.

| username: Jjjjayson_zeng | Original post link

I am looking at this, I don’t know what the two items you mentioned are.

| username: magic | Original post link

The DM-Monitor-Professional and DM-Monitor-Standard dashboards are independent and not part of the TiDB cluster.

| username: Jjjjayson_zeng | Original post link

Do I need to deploy it? I only have the monitoring that comes with the deployment cluster.

| username: magic | Original post link

The DM deployment document is as follows: 使用 TiUP 部署 DM 集群 | PingCAP 文档中心
It includes the Grafana configuration.

| username: Jjjjayson_zeng | Original post link

I don’t know if this is what you’re talking about, but I can’t see what you’re referring to anyway.

| username: magic | Original post link

Open them all to see if there’s the kind I mentioned; you didn’t specify the TiDB version.

| username: 考试没答案 | Original post link

If it’s slow, analyze it: what is currently being executed? Check which data is being synchronized.

| username: kkpeter | Original post link

Turning off safe mode will probably make it much faster.

| username: Jjjjayson_zeng | Original post link

If I turn it off, I still have the issue of duplicate primary keys. I enabled it to use the REPLACE INTO solution when inserting.

| username: dba-kit | Original post link

Could you please send the DM version? If the data in MySQL and TiDB are the same, there generally won’t be a primary key duplication issue. However, some versions of DM do not synchronize the truncate table statement, which may result in duplicate key errors.

| username: Jjjjayson_zeng | Original post link

This project is deployed in the customer’s on-premises environment, and I currently don’t have access. I will ask them for permission to check it. Is there a recommended version for the DM project that is currently deployed?

| username: Hacker007 | Original post link

The DM version needs to be consistent with the TiDB version. Which version are you currently using? Can you determine if it’s a bandwidth issue and analyze the resource usage of the TiDB cluster?

| username: dba-kit | Original post link

If you are deploying a new DM project, it is best to directly deploy the latest LTS version, which is version 6.5.
PS: The DM version can be completely different from the TiDB cluster version, as there is no dependency between them. The role of DM is to parse binlogs and generate standard SQL statements, without being restricted to a specific TiDB version.