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

lightning: buffer all region jobs and consider store balance #56112

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented Sep 18, 2024

What problem does this PR solve?

Issue Number: close #56113

Problem Summary:

What changed and how does it work?

add storeBalancer

	 [prepareAndSendJob]---jobToWorkerCh->[storeBalancer(optional)]->[workers]
	                     ^                                             |
	                     |                                             v
	                     |                           [storeBalancer(optional)]
	                     |                                             |
	                     |                                     jobFromWorkerCh
	                     |                                             |
	                     |                                             v
	               [regionJobRetryer]<-------------[dispatchJobGoroutine]-->done

and refine the components workflow. Now the behaviour of workflow is described in code comment

	// Above is the happy path workflow of region jobs. A job is generated by
	// prepareAndSendJob and terminated to "done" state by dispatchJobGoroutine. We
	// maintain an invariant that the number of generated jobs (after job.ref())
	// minus the number of "done" jobs (after job.done()) equals to jobWg. So we can
	// use jobWg to wait for all jobs to be finished.
	...

Previously I don't want to write many select {case <- ctx.Done: ..., case ...} for every channel action, so in the old code I assume the output channel must not be blocked (which means its reader/receiver must not exit earlier than writer/sender). But after I come back to this function after some months, I found it's hard to remember the different exit behaviour of components. So I changed them to new behaviours like comment said.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

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

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Sep 18, 2024
Copy link

ti-chi-bot bot commented Sep 18, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from lance6716, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 18, 2024
Copy link

tiprow bot commented Sep 18, 2024

Hi @lance6716. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

Attention: Patch coverage is 90.64748% with 26 lines in your changes missing coverage. Please review.

Project coverage is 56.3454%. Comparing base (3ae6470) to head (c9e8fca).
Report is 7 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56112         +/-   ##
=================================================
- Coverage   72.8947%   56.3454%   -16.5494%     
=================================================
  Files          1611       1782        +171     
  Lines        447371     635975     +188604     
=================================================
+ Hits         326110     358343      +32233     
- Misses       101188     253090     +151902     
- Partials      20073      24542       +4469     
Flag Coverage Δ
integration 38.4431% <83.0935%> (?)
unit 72.0281% <89.3382%> (+0.0245%) ⬆️

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

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 52.8887% <ø> (+7.0901%) ⬆️

Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
@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 Sep 19, 2024
Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
@lance6716 lance6716 changed the title [WIP]lightning: buffer all region jobs and consider store balance lightning: buffer all region jobs and consider store balance Sep 19, 2024
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 19, 2024
Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
Signed-off-by: lance6716 <[email protected]>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

balance lighting throughput to all tikvs
1 participant