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

*: Optimize executor runtime stats performance #1532

Merged
merged 12 commits into from
Dec 25, 2024

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Dec 19, 2024

This PR tiny optimize RegionRequestRuntimeStats and SnapshotRuntimeStats by remove useless field and avoid create map.

@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 19, 2024
@crazycs520 crazycs520 changed the title *: Optimize executor runtime stats performance[WIP] *: Optimize executor runtime stats performance Dec 23, 2024
}

// GetRPCCount returns the total rpc types count.
func (r *RegionRequestRuntimeStats) GetRPCCount() int {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about to use GetRPCStatsCount (or sth else)? This name make me think it returns the total number of RPCs of all cmd types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great, done.

// this is to avoid allocating map memory.
FirstRPCStats RPCRuntimeStats
// OtherRPCStatsMap uses to record another types of RPC requests.
OtherRPCStatsMap map[tikvrpc.CmdType]*RPCRuntimeStats
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a suggestion, since one RegionRequestSender typically only send one (or a few) kind(s) of RPC, I guess we can just use a slice here to make the code clean and simple.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great, done.

Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 25, 2024
@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 25, 2024
Copy link

ti-chi-bot bot commented Dec 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, zyguan

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

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 25, 2024
Copy link

ti-chi-bot bot commented Dec 25, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-25 03:45:29.339182469 +0000 UTC m=+1619719.427985004: ☑️ agreed by zyguan.
  • 2024-12-25 04:03:06.795090805 +0000 UTC m=+1620776.883893347: ☑️ agreed by cfzjywxk.

@ti-chi-bot ti-chi-bot bot merged commit f2266d6 into tikv:master Dec 25, 2024
12 checks passed
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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants