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 memory usage #8164

Merged
merged 8 commits into from
Jun 13, 2024
Merged

*: optimize memory usage #8164

merged 8 commits into from
Jun 13, 2024

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented May 10, 2024

What problem does this PR solve?

Issue Number: Ref #7897

What is changed and how does it work?

Check List

Tests

  • Manual test
    compared with beb91c1
goos: linux
goarch: amd64
pkg: github.com/tikv/pd/server/cluster
cpu: Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz
                         │   old.txt   │               new.txt                │
                         │   sec/op    │    sec/op     vs base                │
HandleRegionHeartbeat-72   5.049µ ± 9%   3.248µ ± 15%  -35.67% (p=0.000 n=10)

                         │  old.txt   │              new.txt               │
                         │    B/op    │    B/op     vs base                │
HandleRegionHeartbeat-72   989.5 ± 3%   571.0 ± 4%  -42.29% (p=0.000 n=10)

                         │  old.txt   │              new.txt               │
                         │ allocs/op  │ allocs/op   vs base                │
HandleRegionHeartbeat-72   25.00 ± 0%   14.00 ± 7%  -44.00% (p=0.000 n=10)

Release note

None.

Copy link
Contributor

ti-chi-bot bot commented May 10, 2024

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 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 bot added the release-note-none Denotes a PR that doesn't merit a release note. label May 10, 2024
@ti-chi-bot ti-chi-bot bot requested review from HuSharp and nolouch May 10, 2024 08:41
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 10, 2024
@rleungx rleungx force-pushed the memory branch 4 times, most recently from b697eed to 91fbb40 Compare May 11, 2024 03:45
Copy link

codecov bot commented May 11, 2024

Codecov Report

Attention: Patch coverage is 92.35669% with 12 lines in your changes missing coverage. Please review.

Project coverage is 77.28%. Comparing base (14c68f6) to head (b7ee174).

Current head b7ee174 differs from pull request most recent head 32ce8d9

Please upload reports for the commit 32ce8d9 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8164      +/-   ##
==========================================
- Coverage   77.42%   77.28%   -0.14%     
==========================================
  Files         471      470       -1     
  Lines       61405    61334      -71     
==========================================
- Hits        47540    47400     -140     
- Misses      10308    10358      +50     
- Partials     3557     3576      +19     
Flag Coverage Δ
unittests 77.28% <92.35%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 11, 2024
}
if t, ok := md[ForwardMetadataKey]; ok {
return t[0]
s := metadata.ValueFromIncomingContext(ctx, ForwardMetadataKey)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to change other FromIncomingContext?

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 prefer not for now since it's still in experimental state.

@@ -197,7 +202,7 @@ func (cr *ConcurrentRunner) RunTask(ctx context.Context, f func(context.Context)
}
task.submittedAt = time.Now()
cr.pendingTasks = append(cr.pendingTasks, task)
cr.pendingTaskCount[taskOpts.TaskName]++
Copy link
Member

Choose a reason for hiding this comment

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

Is taskName a required field? If so, should it be in the task struct?

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 28, 2024
rleungx added 5 commits May 28, 2024 16:36
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
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

// Reset timer after setup
b.ResetTimer()
// Run HandleStatsAsync b.N times
for i := 0; i < b.N; i++ {
cluster.HandleStatsAsync(c, region)
}
}

func BenchmarkHandleRegionHeartbeat(b *testing.B) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can run some benchmarks daily.

Signed-off-by: Ryan Leung <[email protected]>
@rleungx rleungx requested a review from HuSharp June 4, 2024 06:03
Copy link
Contributor

ti-chi-bot bot commented Jun 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HuSharp, nolouch

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 added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jun 13, 2024
Copy link
Contributor

ti-chi-bot bot commented Jun 13, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-06-13 07:25:47.069633931 +0000 UTC m=+622301.122945839: ☑️ agreed by HuSharp.

@rleungx rleungx added lgtm status/LGT2 Indicates that a PR has LGTM 2. and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. status/LGT1 Indicates that a PR has LGTM 1. labels Jun 13, 2024
@ti-chi-bot ti-chi-bot bot added status/LGT1 Indicates that a PR has LGTM 1. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Jun 13, 2024
@rleungx
Copy link
Member Author

rleungx commented Jun 13, 2024

/merge

Copy link
Contributor

ti-chi-bot bot commented Jun 13, 2024

@rleungx: We have migrated to builtin LGTM and approve plugins for reviewing.

👉 Please use /approve when you want approve this pull request.

The changes announcement: Proposal: Strengthen configuration change approval.

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 ti-chi-bot bot added the dco-signoff: yes Indicates the PR's author has signed the dco. label Jun 13, 2024
Copy link
Contributor

ti-chi-bot bot commented Jun 13, 2024

@rleungx: Your PR was out of date, I have automatically updated it for you.

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.

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 ti-chi-bot bot merged commit 3e34b80 into tikv:master Jun 13, 2024
16 checks passed
@rleungx rleungx deleted the memory branch June 13, 2024 09:36
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 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/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants