Slow Write Performance in TiDB (Loading Data)

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

Original topic: TiDB 写入慢(load 数据)

| username: TiDBer_K91QR7NE

There is no pressure on TiDB/TiKV, but the write speed is very slow. It used to be fast, but after upgrading from 4.0.8 to 5.4, it became very slow, more than 10 times slower.
The TiKV log contains a large number of errors:
[scheduler.rs:517] [“get snapshot failed”] [err=“Error(Request(message: "peer is not leader for region 155569, leader may Some(id: 155571 store_id: 4)" not_leader { region_id: 155569 leader { id: 155571 store_id: 4 } }))”] [cid=4307487]
Please see the attached TiDB/TiKV logs.

tidb1.log.zip (2.6 MB)
tikv1.log.zip (2.4 MB)

| username: dba-kit | Original post link

Could you please share which SQL queries have slowed down? Is it the load operation in the TiDB logs?

| username: TiDBer_K91QR7NE | Original post link

Yes, the data loading has slowed down.

| username: 裤衩儿飞上天 | Original post link

Is there a lot of errors like "Error(Request(message: “peer is not leader”? Please post the relevant monitoring data, such as leader drop, back off, and PD scheduling.

| username: TiDBer_K91QR7NE | Original post link

The leader drop did not occur, which one does PD want to look at?

| username: Jellybean | Original post link

Is the data being imported into a newly created table using load data? What is the approximate QPS for the import?

  • If it is a newly created table, it is recommended to configure shard_rowid_bit in advance to achieve pre-partitioning and scattering, which helps to improve the import speed.
| username: TiDBer_K91QR7NE | Original post link

Used random

| username: jansu-dev | Original post link

Take a clinic during the load period.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.