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

add saas scenario best practices #20668

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

Conversation

hfxsd
Copy link
Collaborator

@hfxsd hfxsd commented Mar 28, 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)?

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 Mar 28, 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 ask for approval from hfxsd, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

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 contribution This PR is from a community contributor. missing-translation-status This PR does not have translation status info. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 28, 2025
@hfxsd hfxsd requested a review from lilinghai March 28, 2025 08:43
@hfxsd hfxsd added translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. and removed missing-translation-status This PR does not have translation status info. contribution This PR is from a community contributor. labels Mar 28, 2025
@hfxsd hfxsd self-assigned this Mar 28, 2025
@hfxsd hfxsd changed the title initial trans add saas scenario best practices Mar 28, 2025
Copy link

ti-chi-bot bot commented Mar 28, 2025

@Frank945946: 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.

Copy link

ti-chi-bot bot commented Mar 31, 2025

@lilinghai: 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.

@hfxsd
Copy link
Collaborator Author

hfxsd commented Apr 7, 2025

/bot-review

@@ -401,6 +401,7 @@
- [Local Read Under Three Data Centers Deployment](/best-practices/three-dc-local-read.md)
- [Use UUIDs](/best-practices/uuid.md)
- [Read-Only Storage Nodes](/best-practices/readonly-nodes.md)
- [SaaS Multi-Tenant Scenarios](/best-practices/saas-best-practices.md)
Copy link

Choose a reason for hiding this comment

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

The title of the new document is not clear enough. It is recommended to clarify what the best practices are about.

Suggested change
- [SaaS Multi-Tenant Scenarios](/best-practices/saas-best-practices.md)
- [Best Practices for SaaS Multi-Tenant Scenarios](/best-practices/saas-best-practices.md)

Copy link

github-actions bot commented Apr 7, 2025

✅ AI review completed, 1 comments generated.

@lilin90 lilin90 requested review from lilin90 and Copilot April 7, 2025 03:15
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


This document introduces best practices for TiDB in SaaS (Software as a Service) multi-tenant environments, especially in scenarios where the **number of tables in a single cluster exceeds one million**. By making reasonable configurations and choices, you can enable TiDB to run efficiently and stably in SaaS scenarios while reducing resource consumption and costs.

> **Note:**
Copy link
Preview

Copilot AI Apr 7, 2025

Choose a reason for hiding this comment

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

There is an inconsistency with the version recommendations; while the note on line 12 suggests using TiDB v8.5.0 or later, other sections mention features available from TiDB v8.4.0. Consider aligning these version recommendations for clarity.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

@lilin90
Copy link
Member

lilin90 commented Apr 7, 2025

/gemini review

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

The pull request adds a new best practices document for SaaS multi-tenant scenarios. The document provides valuable guidance on hardware requirements, configuration, and optimization techniques for running TiDB in such environments. The addition of this document to the TOC is also appropriate. Overall, this is a good contribution to the documentation.

Summary of Findings

  • Missing links to specific configuration items: The document mentions several TiDB configuration items but does not provide direct links to their documentation. Adding these links would improve the user experience.
  • Inconsistent formatting: There are some inconsistencies in formatting, such as the use of different bullet point styles and spacing. Standardizing the formatting would improve readability.
  • Missing context for hardware recommendations: The hardware recommendations for TiKV and PD are provided without much context. It would be helpful to explain the rationale behind these recommendations and how they relate to the SaaS multi-tenant scenario.

Merge Readiness

The pull request introduces a valuable best practices document. However, addressing the identified issues related to missing links and formatting inconsistencies would further enhance the document's quality and user-friendliness. I am unable to approve this pull request, and recommend that another reviewer also reviews this code before merging.

* [`tidb_auto_build_stats_concurrency`](/system-variables.md#tidb_auto_build_stats_concurrency-new-in-v650) and [`tidb_build_sampling_stats_concurrency`](/system-variables.md#tidb_build_sampling_stats_concurrency-new-in-v750) affect the concurrency of TiDB statistics construction and should be adjusted based on the scenario:
- For scenarios with many partitioned tables, prioritize increasing the value of `tidb_auto_build_stats_concurrency`.
- For scenarios with many columns, prioritize increasing the value of `tidb_build_sampling_stats_concurrency`.
* The product of the three values of `tidb_auto_analyze_concurrency`, `tidb_auto_build_stats_concurrency` and `tidb_build_sampling_stats_concurrency` should not exceed the number of TiDB CPU cores to avoid excessive resource usage.

Choose a reason for hiding this comment

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

medium

The last sentence mentions actual tests. Can you provide more details on the test environment and methodology? This would add credibility to the recommendations.

- For 1 million tables, use BR instances with 32 GiB or more memory.
- For 3 million tables, use BR instances with 64 GiB or more memory.
* BR log backup and snapshot recovery consume additional TiKV memory. It is recommended to use TiKV with 32 GiB or higher memory specifications.
* Adjust the BR configurations [`pitr-batch-count` and `pitr-concurrency`](/br/use-br-command-line-tool.md#common-options) as needed to improve BR log recovery speed.

Choose a reason for hiding this comment

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

medium

Consider adding a direct link to the documentation for pitr-batch-count and pitr-concurrency here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. size/M Denotes a PR that changes 30-99 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.

4 participants