How to Improve the Write Efficiency of the Target TiDB Cluster When Synchronizing Oracle Data

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

Original topic: 同步oracle数据,怎样提升目标端tidb集群写入效率

| username: TiDBer_yBunUeUc

[TiDB Usage Environment] Poc
The business scenario is to synchronize Oracle database report business data to the TiDB database. Testing shows that a table with 1 million fields takes 50 seconds, with an insertion efficiency of over 20,000/s. However, for tables with slightly more fields, the insertion efficiency is only around 3,000/s, and it decreases as the number of fields increases. The business requirement is that the TiDB side’s write efficiency should be at least 20,000/s.

Measures already taken:

  1. Optimized most parameters
  2. Increased memory from 32G to 64G
  3. Removed TiFlash

However, there has been no significant improvement.

Next steps:

  1. Deploy a TiDB cluster of version 7.5
  2. Consider increasing the number of TiKV nodes

Below is the cluster information and hardware configuration:
image

32C 64G 500G HDD and SDD mixed shared storage

Thanks to the community experts for your guidance!

| username: tidb狂热爱好者 | Original post link

Here is my professional advice:

  1. Replace the SSD.

  2. The more indexes in TiDB, the slower it gets.

  3. If Oracle’s OGG import is slow, it is recommended to use DM or CloudCanal.

| username: TiDBer_yBunUeUc | Original post link

  1. Replace SSD — Planning to add nodes to replace it later.

  2. More indexes in TiDB make it slower — There aren’t many indexes, at most the table only has a primary key or unique index.

  3. If Oracle’s OGG import is slow, it is recommended to use DM or CloudCanal — Not considering the time consumption of synchronization tools, the main issue is that there is no significant improvement in write performance on the TiDB side.

| username: 饭光小团 | Original post link

May I ask if there is a hotspot written on the PD interface?

| username: TiDBer_yBunUeUc | Original post link

After checking the monitoring, there is no obvious write hotspot because it is testing the efficiency of a single table.

| username: 饭光小团 | Original post link

Post the IO status of the kv nodes and take a look~

| username: tidb狂热爱好者 | Original post link

TiDB and TiKV running together can cause CPU contention, but the main issue is that TiDB inserts go through transactions, and the more indexes there are, the more it slows down.

| username: TiDBer_yBunUeUc | Original post link

As above

| username: tidb狂热爱好者 | Original post link

If you synchronize from Oracle, it is monotonically increasing without changing the table structure, which is just single-machine performance. Moreover, TiDB’s performance goes through the network, so it will only be worse than Oracle’s single-machine performance. TiDB uses machine performance to achieve scalability. Its write performance is based on hardware, so it will only be worse than single-machine performance.

| username: 饭光小团 | Original post link

Thread CPU
Please also post a screenshot of this monitoring interface.

| username: TiDBer_yBunUeUc | Original post link

The image is not visible. Please provide the text content that needs to be translated.

| username: 江湖故人 | Original post link

When the number of TiKV instances is greater than the number of replicas, theoretically concurrent writes to TiDB will be better than a single-node Oracle.

| username: 有猫万事足 | Original post link

Although you said there’s no hotspot, from this graph, I’m not sure if it’s due to the wrong timing or some other reason, but it’s clear that only 67 is actively working, and the IO is not fully utilized.

If 68 and 69 are only at 15-17 during the import period, I think it’s not much different from just observing.

| username: zhanggame1 | Original post link

Based on my stress testing experience, using a clustered table requires the table to have a primary key, and then not adding any secondary indexes results in the fastest write performance.

| username: tidb菜鸟一只 | Original post link

Check the dashboard to see if there are any hotspot tables. I feel like you definitely haven’t optimized the table structure. TiDB 高并发写入场景最佳实践 | PingCAP 文档中心

| username: dba远航 | Original post link

You can split sections with too many fields.