Skip to content

Conversation

lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Jun 29, 2020

What problem does this PR solve?

Issue Number: close tikv/pd#2526

Problem Summary: Report QPS about each type of command in RegionHeartbeat. for the multi-dimensions hotspot scheduling.

What is changed and how it works?

What's Changed:

Add Grpc info in tls_collect_qps

Related changes

  • PR to update pingcap/kvproto

Check List

Tests

  • Unit test
  • Integration test
  • Manual test

Release note

  • Report Read QPS about each type of command in RegionHeartbeat

@lhy1024 lhy1024 requested a review from nolouch June 29, 2020 14:22
@lhy1024 lhy1024 self-assigned this Jun 29, 2020
@lhy1024 lhy1024 force-pushed the rp branch 2 times, most recently from c8e518f to 0dc9c58 Compare July 1, 2020 17:11
@lhy1024 lhy1024 changed the title [DNM] Report Read QPS about each type of command in RegionHeartbeat [DNM] Report QPS about each type of command in RegionHeartbeat Jul 1, 2020
@lhy1024 lhy1024 force-pushed the rp branch 2 times, most recently from b8623ab to 989fe0f Compare July 1, 2020 17:30
@nolouch nolouch requested a review from HunDunDM July 7, 2020 12:04
@CLAassistant
Copy link

CLAassistant commented Dec 16, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ HunDunDM
❌ lhy1024
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ HunDunDM
❌ lhy1024
You have signed the CLA already but the status is still pending? Let us recheck it.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 31, 2020
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 10, 2021
@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 May 12, 2021
@lhy1024 lhy1024 force-pushed the rp branch 2 times, most recently from 6f08ab0 to 00d70b0 Compare May 13, 2021 08:45
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 13, 2021
@lhy1024 lhy1024 changed the title [DNM] Report QPS about each type of command in RegionHeartbeat Report QPS about each type of command in RegionHeartbeat and StoreHeartbeat May 13, 2021
@lhy1024
Copy link
Contributor Author

lhy1024 commented May 14, 2021

/run-test

@lhy1024
Copy link
Contributor Author

lhy1024 commented May 14, 2021

/rebuild

@Yisaer
Copy link
Contributor

Yisaer commented May 14, 2021

/cc @Yisaer

@ti-chi-bot ti-chi-bot requested a review from Yisaer May 14, 2021 07:40
@zhangjinpeng87
Copy link
Member

This PR lasts too long.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 27, 2021
Cargo.lock Outdated
@@ -2217,7 +2217,7 @@ dependencies = [
[[package]]
name = "kvproto"
version = "0.0.2"
source = "git+https://github.com/pingcap/kvproto.git?rev=511a3225c29f9272af83d28efed92eba835cd34f#511a3225c29f9272af83d28efed92eba835cd34f"
source = "git+https://github.com/lhy1024/kvproto.git?rev=881f9799e333c2464c20b647da831ed5c9013d43#881f9799e333c2464c20b647da831ed5c9013d43"
Copy link
Member

Choose a reason for hiding this comment

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

Why lhy1024 branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After pingcap/kvproto#638 merged, it will be replaced with pingcap branch.

@@ -1114,6 +1114,7 @@ where
"peer_id" => self.fsm.peer_id(),
"res" => ?res,
);
res.metrics.written_query_num += 1;
Copy link
Contributor

@nolouch nolouch May 29, 2021

Choose a reason for hiding this comment

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

It's better in fsm/apply.rs, and the ApplyTaskRes is received after the ApplyPoller call end, it's may handle many commands in one poller round.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 29, 2021
Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 2, 2021
@@ -427,6 +437,7 @@ where

const HOTSPOT_KEY_RATE_THRESHOLD: u64 = 128;
const HOTSPOT_BYTE_RATE_THRESHOLD: u64 = 8 * 1024;
const HOTSPOT_QUERY_RATE_THRESHOLD: u64 = 8; // TODO: need more test
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's too small, assume the bytes 1 key have 64 bytes, it should be 128.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 3, 2021
Signed-off-by: lhy1024 <admin@liudos.us>
Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

rest LGTM

region_peer.last_store_report_read_bytes = region_peer.read_bytes;
region_peer.last_store_report_read_keys = region_peer.read_keys;
info!("read peer qps";"region id"=>region_id,"qps"=>read_query_stats.get_read_query_num());
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this log need to be deleted? it's only for debug?

.store_stat
.engine_total_query_num
.sub_query_stats(&self.store_stat.engine_last_query_num);
info!("read store qps";"store id"=>stats.get_store_id(),"qps"=>res.get_read_query_num());
Copy link
Contributor

Choose a reason for hiding this comment

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

due too. or better with metrics.

@@ -1488,6 +1488,7 @@ where
);
});
}
self.metrics.written_query_num += 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

also need for handle_delete

Signed-off-by: lhy1024 <admin@liudos.us>
Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

lgtm, plz update kvproto

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Yisaer
  • nolouch

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 status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 4, 2021
lhy1024 added 3 commits June 15, 2021 15:15
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
@lhy1024
Copy link
Contributor Author

lhy1024 commented Jun 15, 2021

/merge

@ti-chi-bot
Copy link
Member

@lhy1024: 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: c534edf

@ti-chi-bot ti-chi-bot added status/can-merge Indicates a PR has been approved by a committer. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 15, 2021
@ti-chi-bot ti-chi-bot merged commit 61265d3 into tikv:master Jun 15, 2021
Comment on lines +371 to +373

[patch.'https://github.com/pingcap/kvproto.git']
kvproto = { git = "https://github.com/lhy1024/kvproto.git", rev = "dda0a102bc6ac7371e1f99cd2797825aa210b4a0", default-features = false }
Copy link
Contributor

Choose a reason for hiding this comment

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

Is here on purpose or by accident?

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, an accident.I will fix it later.

@@ -1432,9 +1433,22 @@ where
for req in requests {
let cmd_type = req.get_cmd_type();
let mut resp = match cmd_type {
CmdType::Put => self.handle_put(ctx.kv_wb_mut(), req),
CmdType::Delete => self.handle_delete(ctx.kv_wb_mut(), req),
CmdType::Put => {
Copy link
Member

Choose a reason for hiding this comment

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

Just counting the QPS at apply module can't cover all scenarios, there is a big different CPU cost in grpc and raftstore between 1 request put 100kv and 100 reqeusts with each request puts 1 kv.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

emmm, maybe statistics should be placed at a higher level?

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report QPS about each type of command in RegionHeartbeat
7 participants