Skip to content

batch_system: Add fsm schedule related metrics#17723

Merged
ti-chi-bot[bot] merged 11 commits intotikv:masterfrom
Connor1996:batch-system-metrics
Nov 1, 2024
Merged

batch_system: Add fsm schedule related metrics#17723
ti-chi-bot[bot] merged 11 commits intotikv:masterfrom
Connor1996:batch-system-metrics

Conversation

@Connor1996
Copy link
Member

@Connor1996 Connor1996 commented Oct 28, 2024

What is changed and how it works?

Issue Number: close #18684

What's Changed:

Add fsm schedule related metrics

截屏2024-10-28 16 49 37

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Release note

None

@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. 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 Oct 28, 2024
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@Connor1996 Connor1996 force-pushed the batch-system-metrics branch from a952cc7 to 150433a Compare October 28, 2024 08:18
struct MetricsCollector<N: Fsm> {
timer: Instant, // time since polled
round: usize, // how many round the fsm has been continuously polled
_phantom: std::marker::PhantomData<N>,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_phantom: std::marker::PhantomData<N>,
fsm_type: String,

How about adding a String? It makes the code cleaner.

Copy link
Member Author

Choose a reason for hiding this comment

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

the static metric vector get() only accepts the enum instead of string

)
.unwrap();

pub static ref FSM_RESCHEDULE_COUNTER_VEC: IntCounterVec = register_int_counter_vec!(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why aren't these reschedule metrics shown in the graph of your comments?

Copy link
Member Author

Choose a reason for hiding this comment

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

the screen is not big enough :)

Signed-off-by: Connor1996 <zbk602423539@gmail.com>
};

match sender.send(FsmTypes::Normal(fsm), None) {
match sender.send(FsmTypes::Normal((fsm, Instant::now_coarse())), None) {
Copy link
Member

Choose a reason for hiding this comment

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

The precision of now_coarse is typically ms level and I think it may mislead someone.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think ms is enough here

@hhwyt
Copy link
Contributor

hhwyt commented Oct 29, 2024

LGTM

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 29, 2024

@hhwyt: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

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.

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Oct 29, 2024
pub static ref FSM_POLL_ROUND: FsmPollRoundVec =
auto_flush_from!(FSM_POLL_ROUND_VEC, FsmPollRoundVec);

pub static ref FSM_COUNT_PER_POLL_VEC: HistogramVec =
Copy link
Member

Choose a reason for hiding this comment

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

It would be even better if we can see this metric per poller. But that might not be easy to achieve.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think per poller gives extra information

Connor1996 and others added 8 commits November 1, 2024 09:57
Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
Signed-off-by: Connor <zbk602423539@gmail.com>
Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
Signed-off-by: Connor <zbk602423539@gmail.com>
Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
Signed-off-by: Connor <zbk602423539@gmail.com>
Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
Signed-off-by: Connor <zbk602423539@gmail.com>
Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
Signed-off-by: Connor <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 1, 2024
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 1, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-29 09:40:53.904124196 +0000 UTC m=+342766.743279742: ☑️ agreed by SpadeA-Tang.
  • 2024-11-01 07:23:29.244021496 +0000 UTC m=+593722.083177035: ☑️ agreed by glorv.

@Connor1996
Copy link
Member Author

/approve

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Connor1996, glorv, hhwyt, SpadeA-Tang

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [Connor1996,SpadeA-Tang,glorv]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot merged commit f51e848 into tikv:master Nov 1, 2024
@ti-chi-bot ti-chi-bot bot added this to the Pool milestone Nov 1, 2024
overvenus pushed a commit that referenced this pull request Jun 10, 2025
ref #15990

Add fsm schedule related metrics

Signed-off-by: Connor <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>

Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
overvenus pushed a commit to overvenus/tikv that referenced this pull request Jun 10, 2025
ref tikv#15990

Add fsm schedule related metrics

Signed-off-by: Connor <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>

Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
ti-chi-bot bot pushed a commit that referenced this pull request Jun 10, 2025
ref #15990

Add fsm schedule related metrics

Signed-off-by: Connor <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>

Co-authored-by: Connor <zbk602423539@gmail.com>
Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
@overvenus overvenus added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Jun 17, 2025
ti-chi-bot pushed a commit to ti-chi-bot/tikv that referenced this pull request Jun 17, 2025
ref tikv#15990

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #18557.
But this PR has conflicts, please resolve them!

overvenus pushed a commit to ti-chi-bot/tikv that referenced this pull request Jun 17, 2025
ref tikv#15990

Add fsm schedule related metrics

Signed-off-by: Connor <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>

Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
@overvenus overvenus added the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label Jun 17, 2025
ti-chi-bot pushed a commit to ti-chi-bot/tikv that referenced this pull request Jun 17, 2025
ref tikv#15990

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #18558.
But this PR has conflicts, please resolve them!

ti-chi-bot bot pushed a commit that referenced this pull request Jul 10, 2025
ref #15990, close #18684

Add fsm schedule related metrics

Signed-off-by: Connor <zbk602423539@gmail.com>
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>

Co-authored-by: Connor <zbk602423539@gmail.com>
Co-authored-by: Bisheng Huang <hbisheng@gmail.com>
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Aug 29, 2025
ti-chi-bot pushed a commit to ti-chi-bot/tikv that referenced this pull request Aug 29, 2025
ref tikv#15990

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #18893.
But this PR has conflicts, please resolve them!

@ti-chi-bot ti-chi-bot bot removed the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Aug 29, 2025
squalfof added a commit to squalfof/tikv that referenced this pull request Oct 16, 2025
close tikv#18800, ref tikv#17723

1. in raftstore add apply_msg_len.flush() to trigger metric dump;
2. in raftsotre_v2 add corresponding hist.observe() in
   handle_all_tasks();

Signed-off-by: squalfof <squalfof@gmail.com>
squalfof added a commit to squalfof/tikv that referenced this pull request Oct 21, 2025
close tikv#18800, ref tikv#17723

In raftstore/ add apply_msg_len.flush() to trigger metric dump.

Signed-off-by: squalfof <squalfof@gmail.com>
ti-chi-bot pushed a commit to ti-chi-bot/tikv that referenced this pull request Nov 5, 2025
close tikv#18800, ref tikv#17723

In raftstore/ add apply_msg_len.flush() to trigger metric dump.

Signed-off-by: squalfof <squalfof@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add fsm schedule related metrics

7 participants