tikv / tikv/pd

A simple algorithm for fully utilizing bandwidth for scaling in

Open
#4,137 2 comments 1 reaction 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
1.2k
Forks
783
Avg merge
5d 21h
Merged PRs (30d)
36

Description

## Feature Request

### Describe your feature request related problem

Following is the IO utilization in an experiment that generating snapshot is optimized to cost short constant time and 0 bandwidth.
![image](https://user-images.githubusercontent.com/1701473/133786653-bce4a93c-5356-4283-8b6d-247be7d49f60.png)

The bandwidth used for snapshot replication is set to 50MiB/s. And sending snapshot is counted with factor 1/2 as the data may be in cache already, receiving snapshot is counted with factor 1 as data always have to be written to disk. There are four nodes, and one is being deleted. An optimal scheduling algorithm should utilize all bandwidth, that is 50 * 4 = 200MiB/s. So receiving snapshot should take about 200 * 2 / 3 = 133MiB/s. But the graph above shows that receiving snapshot can only fully utilize the bandwidth at some time.

### Describe the feature you'd like

A simple algorithm to fully utilize bandwidth is to **make every node both sending and receiving snapshot at the same time**. Just making one node keep sending multiple snapshots without receiving may not be optimal as the they may sending to the same other node, so the bandwidth utilization can only be 50 / 2 = 25MiB/s.

Based on the advice from #4099, we may not be able to let offline node to send or receive snapshots as all leaders are evicted. But thanks to https://github.com/tikv/raft-rs/issues/135, we can still make offline nodes keep sending snapshots. So if #4099 is implemented, the we can simply make offline stores send snapshots to all up nodes, and every up nodes should keep sending and receiving snapshots at the same time. I have developed the idea as a simple script and I can see the bandwidth is constantly at limit before offline store is about to get tombstone.

Note we don't need high store limit to fully utilize bandwidth. In my scripts, the store limit for every up nodes is 2.

A complicated way to fully utilize bandwidth is to setup a model to predict bandwidth at each node at real time.

### Describe alternatives you've considered
None

### Teachability, Documentation, Adoption, Migration Strategy
None

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.