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 heartbeat process with concurrent runner - part 1 #8053

Merged
merged 10 commits into from
Apr 15, 2024

Conversation

nolouch
Copy link
Contributor

@nolouch nolouch commented Apr 10, 2024

What problem does this PR solve?

Issue Number: Ref #7897

Part of #8052

What is changed and how does it work?

*: Optimize the heartbeat process with the concurrent runner 
- add a switch about the runner
- move some tasks out, not block the heartbeat process

Check List

Tests

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

Release note

None.

Copy link
Contributor

ti-chi-bot bot commented Apr 10, 2024

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • HuSharp
  • JmPotato

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 do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels Apr 10, 2024
@ti-chi-bot ti-chi-bot bot requested review from HunDunDM and JmPotato April 10, 2024 10:10
@ti-chi-bot ti-chi-bot bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 10, 2024
@ti-chi-bot ti-chi-bot 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 Apr 10, 2024
@nolouch nolouch force-pushed the optimize-heartbeat/async_1 branch 2 times, most recently from f4380e2 to 8961f5b Compare April 10, 2024 10:14
@nolouch nolouch force-pushed the optimize-heartbeat/async_1 branch 5 times, most recently from e670b0b to a75ae5f Compare April 11, 2024 06:28
Signed-off-by: nolouch <nolouch@gmail.com>
@nolouch nolouch requested review from rleungx and removed request for HunDunDM April 11, 2024 06:41
@nolouch nolouch requested a review from HuSharp April 11, 2024 07:15
Signed-off-by: nolouch <nolouch@gmail.com>
@ti-chi-bot ti-chi-bot 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 Apr 11, 2024
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Merging #8053 (85e6950) into master (340c58c) will increase coverage by 0.00%.
The diff coverage is 79.73%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #8053    +/-   ##
========================================
  Coverage   77.36%   77.36%            
========================================
  Files         468      469     +1     
  Lines       60943    61092   +149     
========================================
+ Hits        47146    47262   +116     
- Misses      10252    10278    +26     
- Partials     3545     3552     +7     
Flag Coverage Δ
unittests 77.36% <79.73%> (+<0.01%) ⬆️

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

pkg/cluster/cluster.go Outdated Show resolved Hide resolved
pkg/core/region.go Outdated Show resolved Hide resolved
Signed-off-by: nolouch <nolouch@gmail.com>
@nolouch nolouch changed the title *: optimize heartbeat process with async runner - part 1 *: optimize heartbeat process with concurrent runner - part 1 Apr 11, 2024
Signed-off-by: nolouch <nolouch@gmail.com>
Signed-off-by: nolouch <nolouch@gmail.com>
@nolouch
Copy link
Contributor Author

nolouch commented Apr 15, 2024

PTAL @HuSharp @JmPotato

Signed-off-by: nolouch <nolouch@gmail.com>
Signed-off-by: nolouch <nolouch@gmail.com>
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 15, 2024
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 15, 2024
pkg/core/context.go Show resolved Hide resolved
debug, info := d, i
if taskRunner != nil {
debug = func(msg string, fields ...zap.Field) {
taskRunner.RunTask(
Copy link
Member

Choose a reason for hiding this comment

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

Is the error needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add metrics about this error in next PR.

@@ -81,6 +91,9 @@ func NewCluster(parentCtx context.Context, persistConfig *config.PersistConfig,
storage: storage,
clusterID: clusterID,
checkMembershipCh: checkMembershipCh,

taskRunner: ratelimit.NewConcurrentRunner(hbConcurrentRunner, time.Minute),
Copy link
Member

@rleungx rleungx Apr 15, 2024

Choose a reason for hiding this comment

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

Will it cause the memory to increase a lot if there are many hb requests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it depends on the number of waiting queue closures (tasks). we suppose each costs 128 bytes, 1M is about 128MB. but it's released very quickly I think.

Signed-off-by: nolouch <nolouch@gmail.com>
@nolouch
Copy link
Contributor Author

nolouch commented Apr 15, 2024

/merge

Copy link
Contributor

ti-chi-bot bot commented Apr 15, 2024

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

Copy link
Contributor

ti-chi-bot bot commented Apr 15, 2024

This pull request has been accepted and is ready to merge.

Commit hash: 85e6950

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 15, 2024
@ti-chi-bot ti-chi-bot bot merged commit 0214778 into tikv:master Apr 15, 2024
26 checks passed
@nolouch nolouch deleted the optimize-heartbeat/async_1 branch April 15, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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/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.

4 participants