Skip to content

doc: complementary to desc of in-mem-slow-query-topn-num and and in-mem-slow-query-recent-num. #20521

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 1 commit into
base: master
Choose a base branch
from

Conversation

AilinKid
Copy link
Contributor

@AilinKid AilinKid commented Jun 17, 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 (in Chinese).

  • 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

.
Signed-off-by: AilinKid <[email protected]>
Copy link

ti-chi-bot bot commented Jun 17, 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 hfxsd 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

@AilinKid AilinKid changed the title doc: complementary to desc of in-mem-slow-query-topn-num and and in-mem-slow-query-recent-num`. doc: complementary to desc of in-mem-slow-query-topn-num and and in-mem-slow-query-recent-num. Jun 17, 2025
@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 Jun 17, 2025
@Oreoxmt Oreoxmt self-assigned this Jun 17, 2025
@Oreoxmt Oreoxmt added type/enhancement The issue or PR belongs to an enhancement. translation/doing This PR’s assignee is translating this PR. ONCALL Relates to documentation oncall. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. 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. labels Jun 17, 2025
@ti-chi-bot ti-chi-bot bot removed the missing-translation-status This PR does not have translation status info. label Jun 17, 2025
@Oreoxmt Oreoxmt self-requested a review June 17, 2025 07:57
@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Jun 17, 2025

@AilinKid Could you please invite a tech reviewer? Thanks!

@AilinKid AilinKid requested a review from hawkingrei June 17, 2025 08:30
Copy link

ti-chi-bot bot commented Jun 17, 2025

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

Comment on lines +909 to +913
> **内存查询优先**: 当查询 `INFORMATION_SCHEMA.SLOW_QUERY` 表时候,TiDB 首先检查内存堆上缓存的慢查询,不行然后再去解析节点上的慢查询日志文件,`in-mem-slow-query-topn-num` 提供了指向内存堆中最慢的 N 个慢查询的堆内存缓存数量,该内存堆可以用来提供最慢慢查询的快速内存访问,从而避免解析日志文件。

> **内存消耗**: 该参数用于在快速检索最慢 N 个特征性慢查询的能力与慢查询堆内存占用控制之间实现平衡。设置的太高会导致内存堆在收集慢查询上消耗过多内存,设置太小可能会导致无法提供足够有效的最慢历史慢查询上下文,从而导致需要解析全量的日志文件来获取完整的慢查询信息。

+ 每个 tidb 实例缓存在内存堆中的最慢的 slow query 个数。
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
> **内存查询优先**: 当查询 `INFORMATION_SCHEMA.SLOW_QUERY` 表时候,TiDB 首先检查内存堆上缓存的慢查询,不行然后再去解析节点上的慢查询日志文件,`in-mem-slow-query-topn-num` 提供了指向内存堆中最慢的 N 个慢查询的堆内存缓存数量,该内存堆可以用来提供最慢慢查询的快速内存访问,从而避免解析日志文件。
> **内存消耗**: 该参数用于在快速检索最慢 N 个特征性慢查询的能力与慢查询堆内存占用控制之间实现平衡。设置的太高会导致内存堆在收集慢查询上消耗过多内存,设置太小可能会导致无法提供足够有效的最慢历史慢查询上下文,从而导致需要解析全量的日志文件来获取完整的慢查询信息
+ 每个 tidb 实例缓存在内存堆中的最慢的 slow query 个数。
+ 用于设置每个 TiDB 实例在内存中缓存的最慢的慢查询数量,以提升访问慢查询时的查询性能。具体功能如下:
+ **优化查询流程**:查询 `INFORMATION_SCHEMA.SLOW_QUERY` 表时,TiDB 会优先从内存中读取缓存的慢查询记录。只有在缓存未命中时,TiDB 才会解析本地慢查询日志文件。通过设置 `in-mem-slow-query-topn-num`,你可以指定最多在内存中缓存多少条最慢的慢查询,从而加快访问最慢慢查询的速度并减少日志文件解析的开销
+ **平衡内存使用**:该配置项有助于在提升最慢 N 个慢查询检索效率与控制内存占用之间实现平衡。值设置过高可能导致慢查询缓存占用过多内存,值设置过低则可能因缓存不足而频繁解析日志文件,从而需要解析全量的日志文件以获取完整的慢查询记录。

Comment on lines +918 to +922
> **内存查询优先**: 当查询 `INFORMATION_SCHEMA.SLOW_QUERY` 表时候,TiDB 首先检查内存堆上缓存的慢查询,不行然后再去解析节点上的慢查询日志文件,`in-mem-slow-query-recent-num` 提供了指向内存堆中最近的 N 个慢查询的堆内存缓存数量,该内存堆可以用来提供最近慢查询的快速内存访问,从而避免解析日志文件。

> **内存消耗**: 该参数用于在快速检索最近 N 个特征性慢查询的能力与慢查询堆内存占用控制之间实现平衡。设置的太高会导致内存堆在收集慢查询上消耗过多内存,设置太小可能会导致无法提供足够有效的最近历史慢查询上下文,从而导致需要解析全量的日志文件来获取完整的慢查询信息。

+ 每个 tidb 实例缓存在内存堆中的最近使用的 slow query 个数。
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
> **内存查询优先**: 当查询 `INFORMATION_SCHEMA.SLOW_QUERY` 表时候,TiDB 首先检查内存堆上缓存的慢查询,不行然后再去解析节点上的慢查询日志文件,`in-mem-slow-query-recent-num` 提供了指向内存堆中最近的 N 个慢查询的堆内存缓存数量,该内存堆可以用来提供最近慢查询的快速内存访问,从而避免解析日志文件。
> **内存消耗**: 该参数用于在快速检索最近 N 个特征性慢查询的能力与慢查询堆内存占用控制之间实现平衡。设置的太高会导致内存堆在收集慢查询上消耗过多内存,设置太小可能会导致无法提供足够有效的最近历史慢查询上下文,从而导致需要解析全量的日志文件来获取完整的慢查询信息
+ 每个 tidb 实例缓存在内存堆中的最近使用的 slow query 个数。
+ 用于设置每个 TiDB 实例在内存中缓存的最近使用的慢查询数量,以支持快速访问最近发生的慢查询记录。具体功能如下:
+ **优化查询流程**:查询 `INFORMATION_SCHEMA.SLOW_QUERY` 表时,TiDB 会优先从内存中读取缓存的慢查询记录。如果缓存中没有匹配项,TiDB 会解析本地慢查询日志文件。通过设置 `in-mem-slow-query-recent-num`,你可以指定最多在内存中保留多少条最近的慢查询,以提升查询响应速度
+ **平衡内存使用**:该配置项有助于在提升最近 N 个慢查询检索效率与控制内存占用之间实现平衡。值设置过高可能导致内存占用过多,从而影响系统整体性能。值设置过低则可能导致上下文信息不足,从而需要解析全量的日志文件以获取完整的慢查询记录。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. 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. ONCALL Relates to documentation oncall. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. translation/doing This PR’s assignee is translating this PR. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants