-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 doc for tikv_client_read_timeout
system variable
#14964
Conversation
Signed-off-by: crazycs520 <[email protected]>
@cfzjywxk PTAL |
optimizer-hints.md
Outdated
@@ -742,6 +742,16 @@ SELECT /*+ MAX_EXECUTION_TIME(1000) */ * FROM t1 inner join t2 WHERE t1.id = t2. | |||
|
|||
除了 Hint 之外,系统变量 `global.max_execution_time` 也能对语句执行时间进行限制。 | |||
|
|||
### TIDB_KV_READ_TIMEOUT(N) | |||
|
|||
`TIDB_KV_READ_TIMEOUT(N)` 用于设置查询语句中 TiDB 发送 KV RPC 读请求的超时时间。通常不建议用户设置该变量的值。当 TiDB 集群在网络不稳定,或者 I/O 延迟抖动严重的环境下,且用户对查询 SQL 的延迟比较敏感时,可以通过设置 `TIDB_KV_READ_TIMEOUT(N)` 调小 KV RPC 读请求的超时时间,这样当某个 TiKV 出现 I/O 延迟抖动时,TiDB 侧可以快速超时并重新发送 KV RPC 请求给下一个 KV Region Peer 所在的 TiKV。如果所有 KV Region Peer 都请求超时,则会用默认的超时时间进行重试。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不建议用户使用
我们需要有最佳实践和适配场景指引,一般副作用较大只解决极个别场景的用法才作为 “不推荐、不建议使用”
Co-authored-by: xixirangrang <[email protected]>
system-variables.md
Outdated
> | ||
> - 一般情况下一个普通查询的常规耗时是几毫秒,但偶尔可能会出现某个 TiKV 的网络不稳定、或者某个 TiKV 的 I/O 抖动,导致查询耗时超过 1 秒甚至 10 秒。此时你可以尝试通过 Optimizer Hint `/*+ SET_VAR(TIKV_CLIENT_READ_TIMEOUT=100) */` 为该查询语句设置 TiKV RPC 读请求超时时间为 100 毫秒,这样即使遇到某个 TiKV 查询慢,也可以快速超时然后重新发送 RPC 请求给下一个 TiKV Region Peer 所在的 TiKV。由于两个 TiKV 同时出现 I/O 抖动的概率较低,所以该查询语句的耗时通常可以预期在几毫秒到 110 毫秒之间。 | ||
> - 不建议将 `tikv_client_read_timeout` 的值设置的太小,否则 TiDB 集群在负载压力较大时会很容易导致请求超时,然后重试会进一步增加 TiDB 集群的压力。 | ||
> - 建议使用 Optimizer Hint 为不同类型的查询语句设置不同的超时时间。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后续如果 retry doc 有对应 public doc,这里也可以补充一个 link
/cc @zyguan @crazycs520
@cfzjywxk: GitHub didn't allow me to request PR reviews from the following users: crazycs520. Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs. 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/test-infra repository. |
@cfzjywxk: 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/test-infra repository. |
Co-authored-by: Grace Cai <[email protected]>
Co-authored-by: Grace Cai <[email protected]>
Co-authored-by: Grace Cai <[email protected]>
Co-authored-by: xixirangrang <[email protected]>
tikv_client_read_timeout
system variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@benmaoer: 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/test-infra repository. |
/verify |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: easonn7, hfxsd The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
First-time contributors' checklist
What is changed, added or deleted? (Required)
add doc for tidb_kv_read_timeout system variable and optimizer hint
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).
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?