Skip to content

backup: adjust concurrency description after v8.2 #20963

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

3pointer
Copy link
Contributor

@3pointer 3pointer commented May 16, 2025

First-time contributors' checklist

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.4 (TiDB 8.4 versions)
  • v8.3 (TiDB 8.3 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Copy link

ti-chi-bot bot commented May 16, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign icemap for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 16, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @3pointer, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello! Gemini here, providing a summary of this pull request. This PR focuses on updating the documentation for the br (Backup & Restore) tool, specifically clarifying the roles and recommended usage of the --ratelimit and --concurrency parameters when controlling backup performance and impact on the cluster. It removes the --ratelimit parameter from several example commands and revises the guidance on performance tuning, emphasizing the tikv.backup.num-threads configuration as the primary method.

Highlights

  • Documentation Update: Updates the documentation for the br tool, specifically related to backup performance tuning parameters.
  • Clarified Parameter Usage: Provides clearer explanations for the --ratelimit and --concurrency parameters, detailing their actual effect on backup tasks.
  • Performance Tuning Recommendation: Recommends using the TiKV configuration parameter backup.num-threads as the primary method for controlling backup impact and performance, rather than the br command-line parameters.
  • Example Command Updates: Removes the --ratelimit parameter from several example tiup br backup commands in the documentation.

Changelog

Click here to see the changelog
  • br/br-snapshot-guide.md
    • Removed --ratelimit 128 from the example tiup br backup full command.
    • Removed the description for the --ratelimit parameter.
    • Revised the section on controlling backup impact, recommending tikv.backup.num-threads as the primary method and explaining --ratelimit as an alternative with caveats.
  • br/br-snapshot-manual.md
    • Removed --ratelimit 128 from the example tiup br backup full command.
    • Removed the description for the --ratelimit parameter.
    • Removed --ratelimit 128 from the example tiup br backup db command.
    • Removed --ratelimit 128 from the example tiup br backup table command.
    • Removed --ratelimit 128 from the example tiup br backup full command with filtering.
  • br/use-br-command-line-tool.md
    • Updated the description for the --concurrency parameter to clarify its role in request splitting and recommend tikv.backup.num-threads for performance tuning.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request provides a valuable update to the documentation for BR's --ratelimit and --concurrency parameters. The changes significantly improve clarity by:

  • Recommending backup.num-threads as the primary method for controlling backup impact, and positioning --ratelimit as an alternative for specific scenarios.
  • Clarifying the current role and effect of the --concurrency parameter.

The updated descriptions are more informative and will help users better understand how to manage backup performance and resource utilization. The changes generally adhere to the TiDB Documentation Style Guide.

I have a few minor suggestions for further refinement, mostly related to consistency and formatting. Overall, this is a good improvement to the documentation.

The review was guided by the TiDB Documentation Style Guide, focusing on:

  • Clarity, Simplicity, Completeness, and Readability (Style Guide Line 14): Ensuring the updated descriptions for ratelimit and concurrency are easy for users to understand.
  • Technical Accuracy and Terminology Consistency (Style Guide Line 16): Verifying parameter names and their descriptions, leading to a suggestion for the backup.num-threads link text.
  • Avoiding Unnecessary Words/Repetition (Style Guide Line 24): Pointing out an extra space.
  • Consistent Terminology (and by extension, formatting) (Style Guide Line 25): Suggesting consistent note formatting.

Summary of Findings

  • Note Formatting Consistency: Suggested a minor change to note formatting for consistency across documentation files.
  • Minor Typographical Error: Identified an extra space after a period that could be removed.
  • Link Text Precision: Recommended updating link text to use the exact parameter name for improved technical accuracy.

Merge Readiness

The pull request significantly improves the documentation for BR's ratelimit and concurrency parameters. The changes are clear, accurate, and well-aligned with the project's direction for these features. I've made a few minor suggestions for consistency and formatting. After addressing these small points, or if they are deemed non-critical, the documentation should be in excellent shape. As per the repository's contribution guidelines, I am providing comments rather than requesting changes to avoid blocking the merge. The final decision to merge rests with the maintainers.

@@ -57,7 +57,7 @@
* `--cert`: specifies the path to the SSL certificate in the PEM format.
* `--key`: specifies the path to the SSL certificate key in the PEM format.
* `--status-addr`: specifies the listening address through which `br` provides statistics to Prometheus.
* `--concurrency`: the number of concurrent tasks during the backup.
* `--concurrency`: Controls how backup tasks are split into multiple requests and sent concurrently to the same TiKV node. This parameter primarily affects the granularity of request splitting from BR to TiKV, and no longer directly determines overall backup throughput. In most cases, it is unnecessary to change this value. To improve backup performance, it is recommended to tune [tikv.backup.num-threads](/tikv-configuration-file.md#num-threads-1) instead.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

There's an extra space after the period before "In most cases". Could this be removed for cleaner formatting?1

Style Guide References

Suggested change
* `--concurrency`: Controls how backup tasks are split into multiple requests and sent concurrently to the same TiKV node. This parameter primarily affects the granularity of request splitting from BR to TiKV, and no longer directly determines overall backup throughput. In most cases, it is unnecessary to change this value. To improve backup performance, it is recommended to tune [tikv.backup.num-threads](/tikv-configuration-file.md#num-threads-1) instead.
* `--concurrency`: Controls how backup tasks are split into multiple requests and sent concurrently to the same TiKV node. This parameter primarily affects the granularity of request splitting from BR to TiKV, and no longer directly determines overall backup throughput. In most cases, it is unnecessary to change this value. To improve backup performance, it is recommended to tune [tikv.backup.num-threads](/tikv-configuration-file.md#num-threads-1) instead.

Footnotes

  1. The style guide advises avoiding unnecessary words and repetition. Extra spaces, while minor, fall under the category of unnecessary characters that can be cleaned up. (link)

3pointer and others added 3 commits May 16, 2025 11:56
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@hfxsd hfxsd self-assigned this May 16, 2025
@hfxsd hfxsd added translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. needs-cherry-pick-release-8.3 Should cherry pick this PR to release-8.3 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. needs-cherry-pick-release-8.4 Should cherry pick this PR to release-8.4 branch. and removed missing-translation-status This PR does not have translation status info. labels May 16, 2025
@hfxsd hfxsd self-requested a review May 16, 2025 06:24
@hfxsd hfxsd changed the title br: update ratelimit description backup: adjust concurrency description after v8.2 May 16, 2025
@hfxsd hfxsd requested a review from YuJuncen May 16, 2025 06:24
Copy link

ti-chi-bot bot commented May 16, 2025

@YuJuncen: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@@ -247,8 +245,22 @@ To illustrate the impact of backup, this document lists the test conclusions of

You can use the following methods to manually control the impact of backup tasks on cluster performance. However, these two methods also reduce the speed of backup tasks while reducing the impact of backup tasks on the cluster.

- Use the `--ratelimit` parameter to limit the speed of backup tasks. Note that this parameter limits the speed of **saving backup files to external storage**. When calculating the total size of backup files, use the `backup data size(after compressed)` as a benchmark. When `--ratelimit` is set, to avoid too many tasks causing the speed limit to fail, the `concurrency` parameter of br is automatically adjusted to `1`.
- Adjust the TiKV configuration item [`backup.num-threads`](/tikv-configuration-file.md#num-threads-1) to limit the number of threads used by backup tasks. According to internal tests, when BR uses no more than `8` threads for backup tasks, and the total CPU utilization of the cluster does not exceed 60%, the backup tasks have little impact on the cluster, regardless of the read and write workload.
Recommendation: Adjust the TiKV configuration parameter [`backup.num-threads`](/tikv-configuration-file.md#num-threads-1), which controls the number of worker threads used by backup tasks. Since backup is a CPU-intensive operation, tuning this parameter allows for more precise control over TiKV’s CPU usage, enabling better resource isolation and predictability.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Recommendation: Adjust the TiKV configuration parameter [`backup.num-threads`](/tikv-configuration-file.md#num-threads-1), which controls the number of worker threads used by backup tasks. Since backup is a CPU-intensive operation, tuning this parameter allows for more precise control over TiKV’s CPU usage, enabling better resource isolation and predictability.
- Recommended method: Adjust the TiKV configuration parameter [`backup.num-threads`](/tikv-configuration-file.md#num-threads-1), which controls the number of worker threads used by backup tasks. Because backup is a CPU-intensive operation, tuning this parameter allows for more precise control over TiKV’s CPU usage, enabling better resource isolation and predictability. In most scenarios, simply adjusting `num-threads` is sufficient to limit the impact of backup on the cluster. Internal testing shows that when the number of threads is set to `8` or fewer, and overall cluster CPU usage remains below 60%, the impact of backup on foreground workloads is negligible.

Comment on lines +249 to +250

In most scenarios, simply adjusting `num-threads` is sufficient to limit the impact of backup on the cluster. Internal testing shows that when the number of threads is set to 8 or fewer, and overall cluster CPU usage remains below 60%, the impact of backup on foreground workloads is negligible.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In most scenarios, simply adjusting `num-threads` is sufficient to limit the impact of backup on the cluster. Internal testing shows that when the number of threads is set to 8 or fewer, and overall cluster CPU usage remains below 60%, the impact of backup on foreground workloads is negligible.

Comment on lines +253 to +254

When enabled, BR will automatically set `--concurrency` to 1 to reduce the number of concurrent requests.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When enabled, BR will automatically set `--concurrency` to 1 to reduce the number of concurrent requests.


In most scenarios, simply adjusting `num-threads` is sufficient to limit the impact of backup on the cluster. Internal testing shows that when the number of threads is set to 8 or fewer, and overall cluster CPU usage remains below 60%, the impact of backup on foreground workloads is negligible.

Alternative: If you have already set `backup.num-threads` to a low value (e.g., 1) but still want to further reduce the impact of backup on the cluster, consider using the `--ratelimit` parameter. This option limits the bandwidth used to write backup files to external storage, specified in MiB/s. Note that the actual rate limiting effect depends on the size of the compressed data. You can refer to the `backup data size (after compressed)` field in the logs for more insight.
Copy link
Collaborator

@hfxsd hfxsd May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Alternative: If you have already set `backup.num-threads` to a low value (e.g., 1) but still want to further reduce the impact of backup on the cluster, consider using the `--ratelimit` parameter. This option limits the bandwidth used to write backup files to external storage, specified in MiB/s. Note that the actual rate limiting effect depends on the size of the compressed data. You can refer to the `backup data size (after compressed)` field in the logs for more insight.
- Alternative method: If you have already set `backup.num-threads` to a small value (for example, `1`), but still want to further reduce the impact of backup on the cluster, consider using the `--ratelimit` parameter. This option limits the bandwidth used to write backup files to external storage, specified in MiB/s. Note that the actual rate limiting effect depends on the size of the compressed data. You can refer to the `backup data size (after compressed)` field in the logs for more insight. When `--ratelimit` is enabled, BR automatically sets `--concurrency` to `1` to reduce the number of concurrent requests.

>
> In such situations, consider the following alternatives:
>
> - [Scale out a cluster](/tiup/tiup-component-cluster-scale-out.md) to increase available resources.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> - [Scale out a cluster](/tiup/tiup-component-cluster-scale-out.md) to increase available resources.
> - [Scale out a cluster](/tiup/tiup-cluster.md#scale-out-a-cluster) to increase available resources.

@@ -57,7 +57,7 @@ A `tiup br` command consists of multiple layers of sub-commands. Currently, br c
* `--cert`: specifies the path to the SSL certificate in the PEM format.
* `--key`: specifies the path to the SSL certificate key in the PEM format.
* `--status-addr`: specifies the listening address through which `br` provides statistics to Prometheus.
* `--concurrency`: the number of concurrent tasks during the backup.
* `--concurrency`: Controls how backup tasks are split into multiple requests and sent concurrently to the same TiKV node. This parameter primarily affects the granularity of request splitting from BR to TiKV, and no longer directly determines overall backup throughput. In most cases, it is unnecessary to change this value. To improve backup performance, it is recommended to tune [`backup.num-threads`](/tikv-configuration-file.md#num-threads-1) instead.
Copy link
Collaborator

@hfxsd hfxsd May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `--concurrency`: Controls how backup tasks are split into multiple requests and sent concurrently to the same TiKV node. This parameter primarily affects the granularity of request splitting from BR to TiKV, and no longer directly determines overall backup throughput. In most cases, it is unnecessary to change this value. To improve backup performance, it is recommended to tune [`backup.num-threads`](/tikv-configuration-file.md#num-threads-1) instead.
* `--concurrency`: controls how backup tasks are split into multiple requests and sent concurrently to the same TiKV node. This parameter primarily affects the granularity of request splitting from BR to TiKV, and no longer directly determines overall backup throughput. In most cases, it is not necessary to change this value. To improve backup performance, it is recommended to tune [`tikv.backup.num-threads`](/tikv-configuration-file.md#num-threads-1) instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-8.3 Should cherry pick this PR to release-8.3 branch. needs-cherry-pick-release-8.4 Should cherry pick this PR to release-8.4 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants