How to increase the replication speed on TiFlash? #66454
Replies: 2 comments
|
Original author: TiDB-AI-Assistant According to the official documentation , before TiFlash replicas are added, each TiKV instance performs a full table scan and sends the scanned data to TiFlash as a “snapshot” to create replicas. By default, TiFlash replicas are added slowly with fewer resources usage in order to minimize the impact on the online service. If there are spare CPU and disk IO resources in your TiKV and TiFlash nodes, you can accelerate TiFlash replication by temporarily increasing the snapshot write speed limit for each TiKV and TiFlash instance. To increase the snapshot write speed limit, you can use the Dynamic Config SQL statement. The default value for both configurations is 100MiB, i.e. the maximum disk bandwidth used for writing snapshots is no more than 100MiB/s. You can temporarily increase the snapshot write speed limit for each TiKV and TiFlash instance by executing the following command: Within a few minutes, you will observe a significant increase in CPU and disk IO resource usage of the TiFlash nodes, and TiFlash should create replicas faster. At the same time, the TiKV nodes’ CPU and disk IO resource usage increases as well. If the TiKV and TiFlash nodes still have spare resources at this point and the latency of your online service does not increase significantly, you can further ease the limit, for example, triple the original speed: After the TiFlash replication is complete, you should revert to the default configuration to reduce the impact on online services. You can execute the following PD Control command to restore the default new replica speed limit: Please note that the above steps are not applicable to TiDB Cloud . |
|
Original author: WalterWj Added: Use TiFlash | PingCAP Docs |
Uh oh!
There was an error while loading. Please reload this page.
Original author: aaarnell
Original time: 2023-07-11 07:02:18.632197
Original ID/Slug: 619 / how-to-increase-the-replication-speed-on-tiflash
TiDB version: 7.1.0
Problem:
I’m trying to create replica tables in TiFlash. The write speed to TiFlash disks is about 30 MiB per second. This is slow when replicating several terabytes. How to increase the replication speed on TiFlash?
Resource allocation:
3 hosts. Characteristics of each:
Cluster Configuration:
1 host: 1 PD, 1 TiDB, 2 TiKV, 1 TiFlash (storage - 2 hdd)
2 host: 1 PD, 1 TiDB, 2 TiKV, 1 TiFlash (storage - 2 hdd)
3 host: 1 PD, 1 TiDB, 2 TiKV, 1 TiFlash (storage - 2 hdd)
Configuration:
global:
user: “tidb”
ssh_port: 22
deploy_dir: “/data10/tidb-deploy”
data_dir: “/data9/tidb-data”
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
server_configs:
tidb:
log.slow-threshold: 300
tikv:
readpool.unified.max-thread-count: 24
readpool.storage.use-unified-pool: true
readpool.coprocessor.use-unified-pool: true
storage.scheduler-concurrency: 1024000
pd:
replication.location-labels: [“host”]
replication.enable-placement-rules: true
schedule.leader-schedule-limit: 4
schedule.region-schedule-limit: 2048
schedule.replica-schedule-limit: 64
pd_servers:
client_port: 2382
peer_port: 2383
deploy_dir: “/data1/tidb-deploy/pd-2382”
log_dir: “/data1/tidb-deploy/pd-2382/log”
data_dir: “/data2/tidb-data/pd-2382”
deploy_dir: “/data1/tidb-deploy/pd-2379”
log_dir: “/data1/tidb-deploy/pd-2379/log”
data_dir: “/data2/tidb-data/pd-2379”
deploy_dir: “/data1/tidb-deploy/pd-2379”
log_dir: “/data1/tidb-deploy/pd-2379/log”
data_dir: “/data2/tidb-data/pd-2379”
tidb_servers:
deploy_dir: “/data1/tidb-deploy/tidb-4000”
log_dir: “/data1/tidb-deploy/tidb-4000/log”
deploy_dir: “/data1/tidb-deploy/tidb-4000”
log_dir: “/data1/tidb-deploy/tidb-4000/log”
deploy_dir: “/data1/tidb-deploy/tidb-4000”
log_dir: “/data1/tidb-deploy/tidb-4000/log”
tikv_servers:
port: 20160
status_port: 20180
deploy_dir: “/data3/tidb-deploy/tikv-20160”
log_dir: “/data3/tidb-deploy/tikv-20160/log”
data_dir: “/data4/tidb-data/tikv-20160”
config:
server.labels: { host: “tikv1” }
port: 20161
status_port: 20181
deploy_dir: “/data5/tidb-deploy/tikv-20161”
log_dir: “/data5/tidb-deploy/tikv-20161/log”
data_dir: “/data6/tidb-data/tikv-20161”
config:
server.labels: { host: “tikv1” }
port: 20160
status_port: 20180
deploy_dir: “/data3/tidb-deploy/tikv-20160”
log_dir: “/data3/tidb-deploy/tikv-20160/log”
data_dir: “/data4/tidb-data/tikv-20160”
config:
server.labels: { host: “tikv2” }
port: 20161
status_port: 20181
deploy_dir: “/data5/tidb-deploy/tikv-20161”
log_dir: “/data5/tidb-deploy/tikv-20161/log”
data_dir: “/data7/tidb-data/tikv-20161”
config:
server.labels: { host: “tikv2” }
port: 20160
status_port: 20180
deploy_dir: “/data3/tidb-deploy/tikv-20160”
log_dir: “/data3/tidb-deploy/tikv-20160/log”
data_dir: “/data4/tidb-data/tikv-20160”
config:
server.labels: { host: “tikv3” }
port: 20161
status_port: 20181
deploy_dir: “/data5/tidb-deploy/tikv-20161”
log_dir: “/data5/tidb-deploy/tikv-20161/log”
data_dir: “/data6/tidb-data/tikv-20161”
config:
server.labels: { host: “tikv3” }
tiflash_servers:
config:
storage.main.dir: [“/data8/tidb-data/tiflash-9000”, “/data9/tidb-data/tiflash-9000”]
storage.main.capacity: [3298534883328, 3298534883328]
config:
storage.main.dir: [“/data8/tidb-data/tiflash-9000”, “/data9/tidb-data/tiflash-9000”]
storage.main.capacity: [3298534883328, 3298534883328]
config:
storage.main.dir: [“/data8/tidb-data/tiflash-9000”, “/data9/tidb-data/tiflash-9000”]
storage.main.capacity: [3298534883328, 3298534883328]
monitoring_servers:
port: 9091
grafana_servers:
alertmanager_servers:
All reactions