Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pd: store limit updates #20144

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions configure-store-limit.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ aliases: ['/docs/dev/configure-store-limit/']

# Store Limit

Store Limit is a feature of PD, introduced in TiDB 3.0. It is designed to control the scheduling speed in a finer manner for better performance in different scenarios.
Store Limit is a feature of PD. It is designed to control the scheduling speed in a finer manner for better performance in different scenarios.

## Implementation principles

Expand All @@ -28,44 +28,40 @@ Every time an operator is generated, it checks whether enough tokens exist in th

Store Limit is different from other limit-related parameters in PD (such as `region-schedule-limit` and `leader-schedule-limit`) in that it mainly limits the consuming speed of operators, while other parameters limits the generating speed of operators. Before introducing the Store Limit feature, the speed limit of scheduling is mostly at the global scope. Therefore, even if the global speed is limited, it is still possible that the scheduling operations are concentrated on some stores, affecting the performance of the cluster. By limiting the speed at a finer level, Store Limit can better control the scheduling behavior.

Store Limit defines the maximum number of operations per minute. With a Store Limit of 5 operations per minute, adding a new node to the cluster will process 5 Regions per minute (`add-peer` operations). If 15 Regions require an `add-peer`, the operation will take 3 minutes (15 / 5 = 3) and consume up to 8 MiB/s ((5 × 96) / 60 = 8), assuming each Region is 96 MiB.

## Usage

The parameters of Store Limit can be configured using `pd-ctl`.
The parameters of Store Limit can be configured using [`PD Control`](/pd-control.md).

### View setting of the current store

To view the limit setting of the current store, run the following commands:

{{< copyable "shell-regular" >}}

```bash
store limit // Shows the speed limit of adding and deleting peers in all stores.
store limit add-peer // Shows the speed limit of adding peers in all stores.
store limit remove-peer // Shows the speed limit of deleting peers in all stores.
tiup ctl:v<CLUSTER_VERSION> pd store limit // Shows the speed limit of adding and deleting peers in all stores.
tiup ctl:v<CLUSTER_VERSION> pd store limit add-peer // Shows the speed limit of adding peers in all stores.
tiup ctl:v<CLUSTER_VERSION> pd store limit remove-peer // Shows the speed limit of deleting peers in all stores.
```

### Set limit for all stores

To set the speed limit for all stores, run the following commands:

{{< copyable "shell-regular" >}}

```bash
store limit all 5 // All stores can at most add and delete 5 peers per minute.
store limit all 5 add-peer // All stores can at most add 5 peers per minute.
store limit all 5 remove-peer // All stores can at most delete 5 peers per minute.
tiup ctl:v<CLUSTER_VERSION> pd store limit all 5 // All stores can at most add and delete 5 peers per minute.
tiup ctl:v<CLUSTER_VERSION> pd store limit all 5 add-peer // All stores can at most add 5 peers per minute.
tiup ctl:v<CLUSTER_VERSION> pd store limit all 5 remove-peer // All stores can at most delete 5 peers per minute.
```

### Set limit for a single store

To set the speed limit for a single store, run the following commands:

{{< copyable "shell-regular" >}}

```bash
store limit 1 5 // store 1 can at most add and delete 5 peers per minute.
store limit 1 5 add-peer // store 1 can at most add 5 peers per minute.
store limit 1 5 remove-peer // store 1 can at most delete 5 peers per minute.
tiup ctl:v<CLUSTER_VERSION> pd store limit 1 5 // store 1 can at most add and delete 5 peers per minute.
tiup ctl:v<CLUSTER_VERSION> pd store limit 1 5 add-peer // store 1 can at most add 5 peers per minute.
tiup ctl:v<CLUSTER_VERSION> pd store limit 1 5 remove-peer // store 1 can at most delete 5 peers per minute.
```

### Principles of store limit v2
Expand Down
Loading