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

*: apply perf flags to record RocksDB perf context in coprocessor #12432

Merged
merged 4 commits into from
May 6, 2022

Conversation

sticnarf
Copy link
Contributor

What is changed and how it works?

Issue Number: Ref #12362

What's Changed:

This commit enables some more perf flags about reading, such as
block read time, DB mutex wait time. So, it enables us to find out
the root cause of more performance issues.

It also includes some refactorings of unifying the functions of capturing
PerfContext in tikv_kv into engine_rocks because engine specific functions
should be hidden in engine_* as much as possible. This is the first step that
removes statistics from tikv_kv, and later code referencing directly to the
engine_rocks should be also removed.

Check List

Tests

  • Existing tests

Side effects

  • Performance regression
    • Consumes more CPU

I tried TPC-H and sysbench select_random_ranges and find no obvious regression.

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Apr 26, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • you06
  • zhongzc

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 release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 26, 2022
@you06
Copy link
Contributor

you06 commented May 5, 2022

What do you think of setting the read stats in the coprocessor response's execution details?

@sticnarf
Copy link
Contributor Author

sticnarf commented May 5, 2022

What do you think of setting the read stats in the coprocessor response's execution details?

Yes, they should be returned, but I'm not going to include them in this PR.

We are going to add a few more execution details, not only about coprocessor read, but also about write operations. I plan to think more about the protocol before including the statistics in the response.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 5, 2022
Comment on lines 204 to +216
PerfContextKind::RaftstoreApply => {
report_perf_context!(self, APPLY_PERF_CONTEXT_TIME_HISTOGRAM_STATIC);
report_write_perf_context!(self, APPLY_PERF_CONTEXT_TIME_HISTOGRAM_STATIC);
}
PerfContextKind::RaftstoreStore => {
report_perf_context!(self, STORE_PERF_CONTEXT_TIME_HISTOGRAM_STATIC);
report_write_perf_context!(self, STORE_PERF_CONTEXT_TIME_HISTOGRAM_STATIC);
}
PerfContextKind::GenericRead => {
// TODO: Currently, metrics about reading is reported in other ways.
// It is better to unify how to report the perf metrics.
//
// Here we only record the PerfContext data into the fields.
self.read = ReadPerfContext::capture();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

make it generics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, what do you want it to be generic about? This is under engine_rocks, so it needn't be generic over engine.

Copy link
Contributor

Choose a reason for hiding this comment

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

I hadn't thought clearly. Never mind...

So we will report these statistics as metrics in the future?

Copy link
Contributor

Choose a reason for hiding this comment

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

And those statistics will also return as coprocessor response...

I hope that there will be an explicit way to remind people of their multiple purposes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already do. Now, it's in the coprocessor mod where we report these statistics.
But I think we can report these metrics like raftstore statistics here as well. So, it will look more consistent about reporting rocksdb statistics.

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 about changing report_metrics to stop_observe and add another trait function to PerfContext to get the inner data?

@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 May 6, 2022
@sticnarf
Copy link
Contributor Author

sticnarf commented May 6, 2022

/merge

@ti-chi-bot
Copy link
Member

@sticnarf: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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.

@ti-chi-bot
Copy link
Member

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

Commit hash: ab7bb6a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 6, 2022
@ti-chi-bot ti-chi-bot merged commit 2ba4cf0 into tikv:master May 6, 2022
3AceShowHand pushed a commit to 3AceShowHand/tikv that referenced this pull request May 7, 2022
…kv#12432)

ref tikv#12362

This commit enables some more perf flags about reading, such as
block read time, DB mutex wait time. So, it enables us to find out
the root cause of more performance issues.

It also includes some refactorings of unifying the functions of capturing
PerfContext in tikv_kv into engine_rocks because engine specific functions
should be hidden in engine_* as much as possible. This is the first step that
removes statistics from tikv_kv, and later code referencing directly to the
engine_rocks should be also removed.

Signed-off-by: Yilin Chen <[email protected]>
Signed-off-by: 3AceShowHand <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants