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 last_observed_time for raft messages #1276

Merged
merged 4 commits into from
Nov 22, 2024
Merged

Conversation

hhwyt
Copy link
Contributor

@hhwyt hhwyt commented Nov 6, 2024

For RaftMessage send & send wait duration metric, we need the last_observed_time field for the BatchRaftMessage. More details see: tikv/tikv#17735.

@ti-chi-bot ti-chi-bot bot added the size/XS label Nov 6, 2024
@CLAassistant
Copy link

CLAassistant commented Nov 6, 2024

CLA assistant check
All committers have signed the CLA.

@@ -29,6 +29,8 @@ message RaftMessage {
bytes extra_ctx = 11;

disk_usage.DiskUsage disk_usage = 12;
// Used to measure the send wait duration.
uint64 last_observed_time = 13;
Copy link
Member

Choose a reason for hiding this comment

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

As BatchRaftMessage has one, why bother recording it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Connor1996 There are two steps:

  1. RaftStore sends a RaftMessage to the RaftClient, placing the RaftMessage into the RaftClient buffer. (in RaftClient::send.)
  2. The RaftClient batches RaftMessages into a BatchMessageBuffer and flushes them as BatchRaftMessages to gRPC.

The last_observed_time in RaftMessage is used to monitor the first step, where BatchRaftMessage has not yet been created.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like we don't need to add a new field in protobuf, as step 1 occurs within the process with no inter-network communication.

Copy link

ti-chi-bot bot commented Nov 12, 2024

@Connor1996: 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.

Copy link
Contributor

@v01dstar v01dstar left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

ti-chi-bot bot commented Nov 14, 2024

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

In response to this:

lgtm

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.

Copy link
Contributor

@LykxSassinator LykxSassinator left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Nov 15, 2024

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

In response to this:

LGTM

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.

@glorv
Copy link
Contributor

glorv commented Nov 15, 2024

@overvenus PTAL

@hhwyt
Copy link
Contributor Author

hhwyt commented Nov 15, 2024

/assign @overvenus

@hhwyt
Copy link
Contributor Author

hhwyt commented Nov 15, 2024

/cc @overvenus PTAL, thx~

@hhwyt
Copy link
Contributor Author

hhwyt commented Nov 15, 2024

/assign @hhwyt

@hhwyt
Copy link
Contributor Author

hhwyt commented Nov 21, 2024

/cc @overvenus I've removed the last_observed_time for RaftMessage. PTAL again, thx~

@ti-chi-bot ti-chi-bot bot removed the lgtm label Nov 21, 2024
@hhwyt
Copy link
Contributor Author

hhwyt commented Nov 21, 2024

/cc @cfzjywxk PTAL, thx~

Copy link
Contributor

@cfzjywxk cfzjywxk left a comment

Choose a reason for hiding this comment

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

@hhwyt
Copy link
Contributor Author

hhwyt commented Nov 21, 2024

/retest

Copy link

ti-chi-bot bot commented Nov 21, 2024

@hhwyt: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

@glorv
Copy link
Contributor

glorv commented Nov 21, 2024

/retest

@glorv
Copy link
Contributor

glorv commented Nov 21, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot removed the lgtm label Nov 21, 2024
@hhwyt
Copy link
Contributor Author

hhwyt commented Nov 21, 2024

Better to update the latency break down whole picture like https://docs.google.com/presentation/d/1Jsha70eEGUOWQOGR5VtDkplGMZYMBMmVh67At6o_4lk/edit#slide=id.geb29d9636c_2_0 does, and update related information in https://docs.pingcap.com/tidb/stable/latency-breakdown

@cfzjywxk 👍🏻. I'll update it later.

@hhwyt
Copy link
Contributor Author

hhwyt commented Nov 21, 2024

@cfzjywxk PTAL again, the LGTM label was removed by a misoperation. Thanks~

Copy link
Contributor

@v01dstar v01dstar left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

ti-chi-bot bot commented Nov 21, 2024

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

In response to this:

lgtm

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-sigs/prow repository.

Copy link

ti-chi-bot bot commented Nov 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, Connor1996, glorv, LykxSassinator, overvenus, v01dstar

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented Nov 22, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-15 09:05:17.82562336 +0000 UTC m=+606280.016492357: ☑️ agreed by glorv.
  • 2024-11-21 03:50:01.246102538 +0000 UTC m=+89988.865757041: ☑️ agreed by overvenus.
  • 2024-11-21 04:23:17.021346358 +0000 UTC m=+91984.641000876: ✖️🔁 reset by hhwyt.
  • 2024-11-21 06:06:57.398275246 +0000 UTC m=+98205.017929761: ☑️ agreed by overvenus.
  • 2024-11-21 07:07:53.227844983 +0000 UTC m=+101860.847499499: ☑️ agreed by cfzjywxk.
  • 2024-11-21 10:24:14.731863435 +0000 UTC m=+113642.351517955: ✖️🔁 reset by glorv.
  • 2024-11-21 11:39:47.841224292 +0000 UTC m=+118175.460878808: ☑️ agreed by overvenus.
  • 2024-11-22 01:51:37.202847971 +0000 UTC m=+169284.822502486: ☑️ agreed by cfzjywxk.

@ti-chi-bot ti-chi-bot bot merged commit 17bdaaa into pingcap:master Nov 22, 2024
5 checks passed
ti-chi-bot bot pushed a commit to tikv/tikv that referenced this pull request Nov 22, 2024
close #17683

Add metrics for raft message send wait & receive delay duration

## Send wait duration

This phase begins when the RaftStore thread sends the RaftMessage
to the RaftClient and ends when the RaftMessage leaves the
BatchRaftMessage buffer, just before being flushed to the gRPC client.
Since this phase occurs entirely within the same node, we measure it
using monotonic time.

## Receive delay duration

Receive delay duration can also be called send duration. The name 
'Receive delay duration' is used because this duration is reported 
by the receiver, making it more clearer.

This phase begins after the send wait ends and continues as the message
is sent over the network, ends when the target peer receives it.
Since this phase spans across nodes, we measure it using physical time.
To facilitate this, we’ve introduced a last_observed_time field in
the BatchRaftMessage to record the physical times (please also review
the related PR: pingcap/kvproto#1276).
Although physical clock drift between nodes is a possibility, its
impact on our measurement is limited. Our primary goal is to observe
trends in duration changes rather than relying on absolute precision.

NOTE: Metrics are only added for the batch_raft RPC, as the raft
RPC is deprecated and no longer tracked.

Signed-off-by: hhwyt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants