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 latency formula #9763

Merged
merged 20 commits into from
Sep 19, 2022
Merged

Add latency formula #9763

merged 20 commits into from
Sep 19, 2022

Conversation

you06
Copy link
Contributor

@you06 you06 commented Jul 28, 2022

First-time contributors' checklist

What is changed, added or deleted? (Required)

Add a document about query latency breakdown.

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)
  • v6.2 (TiDB 6.2 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 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

you06 added 2 commits July 28, 2022 08:47
Signed-off-by: you06 <[email protected]>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 28, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Oreoxmt
  • ran-huang

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 28, 2022
@ti-chi-bot ti-chi-bot requested a review from shichun-0415 July 28, 2022 16:15
@ti-chi-bot ti-chi-bot added missing-translation-status This PR does not have translation status info. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 28, 2022
@shichun-0415 shichun-0415 added translation/doing This PR's assignee is translating this PR. and removed missing-translation-status This PR does not have translation status info. labels Jul 30, 2022
Signed-off-by: you06 <[email protected]>
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 3, 2022
Signed-off-by: you06 <[email protected]>
@you06 you06 marked this pull request as ready for review August 3, 2022 06:40
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 3, 2022
@you06
Copy link
Contributor Author

you06 commented Aug 3, 2022

@cfzjywxk @sticnarf can you give some advice on this document?

you06 added 2 commits August 4, 2022 22:52
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
@you06
Copy link
Contributor Author

you06 commented Aug 5, 2022

I added the railroad diagrams and here is a screenshot of doc page.

@cfzjywxk @sticnarf PTAL again.

image

you06 added 2 commits August 5, 2022 17:31
@you06 you06 requested review from cfzjywxk and sticnarf August 9, 2022 02:55
prewrite_ratio = ceil(
sum(rate(tidb_tikvclient_txn_regions_num_sum{type="2pc_prewrite"})) /
sum(rate(tidb_tikvclient_txn_regions_num_count{type="2pc_prewrite"})) /
128
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be explained (committer-concurrency)

)
```

TiKV supports Async IO Raft since v5.3.0, which changes the process of commit.
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's clarify it's not enabled by default. It's enabled when store-io-pool-size > 0

Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
@@ -683,7 +763,7 @@ async io enabled commit = max(
)
```

TiKV supports Async IO Raft since v5.3.0(only enabled when [`store-io-pool-size > 0`](/tikv-configuration-file.md#store-io-pool-size-new-in-v530)), which changes the process of commit.
Since v5.3.0, TiKV supports Async IO Raft, which only enabled when setting the [`store-io-pool-size`](/tikv-configuration-file.md#store-io-pool-size-new-in-v530) as a positive value, which changes the process of commit. The `persist log locally duration` and `wait by write worker duration` are calculated as:
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is Async IO? "Async IO" is not introduced in the store-io-pool-size configuration item.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Async IO" means handle writes of committing Raft log by a "StoreWriter thread pool", I'll change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because "Async IO" is used frequently between developers, I kept it and added a description.

@Oreoxmt Oreoxmt force-pushed the add-latency-formula branch from 82d1522 to 6285301 Compare September 9, 2022 03:11
@Oreoxmt Oreoxmt requested a review from ran-huang September 9, 2022 03:12
@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Sep 9, 2022

@you06 @ran-huang Preview link is here

Signed-off-by: you06 <[email protected]>
@Oreoxmt Oreoxmt self-requested a review September 13, 2022 08:38

# Latency Breakdown

This document breaks down the latency into metrics and then analyzes it from the user's perspective, which provides you with a deep insight into time cost during TiDB SQL queries. This is a guide to TiDB's critical path diagnosis.
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Can you briefly define "latency"? What does it mean in this doc?

  2. Give your readers a bird's-eye view of the whole doc. For example:

    This document analyzes TiDB latency from xx aspects: 
      - General SQL layer
      - Read queries
      - ...
    


## Read queries

Read queries have only a single process form.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand "single process form". Can you explain it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I mean is there is only one form for processing read requests, and there are no extra works after the read process.

@Oreoxmt Oreoxmt mentioned this pull request Sep 15, 2022
13 tasks
Signed-off-by: you06 <[email protected]>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 15, 2022
@Oreoxmt Oreoxmt added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR's assignee is translating this PR. labels Sep 15, 2022
Copy link
Contributor

@sticnarf sticnarf left a comment

Choose a reason for hiding this comment

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

LGTM

@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Sep 19, 2022

/merge

@ti-chi-bot
Copy link
Member

@Oreoxmt: /merge in this pull request requires 2 approval(s).

In response to this:

/merge

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 ti-community-infra/tichi repository.

Copy link
Collaborator

@Oreoxmt Oreoxmt left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 19, 2022
@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Sep 19, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 321d6f6

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 19, 2022
@Oreoxmt Oreoxmt closed this Sep 19, 2022
@Oreoxmt Oreoxmt reopened this Sep 19, 2022
@ti-chi-bot ti-chi-bot merged commit 2e8f2aa into pingcap:master Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. v6.3 This PR/issue applies to TiDB v6.3.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants