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

load balance by CUs #1221

Merged
merged 1 commit into from
May 7, 2024
Merged

Conversation

apfitzge
Copy link

@apfitzge apfitzge commented May 7, 2024

Problem

  • Current load balancing is done by transaction count
  • This leads to unbalanced loads across the threads
  • Until Scheduler - prioritization fees/cost solana-labs/solana#34888 CUs were totally innaccurate. However, in recent epochs with the prioritization change, the top scheduled txs are showing significantly more accurate estimates

Summary of Changes

  • Use CUs to load-balance across threads

Fixes #

batches_per_thread[thread_id].len() + in_flight_per_thread[thread_id],
)
})
.min_by(|a, b| a.1.cmp(&b.1))
.map(|(thread_id, _)| thread_id)
.min_by(|a, b| a.1.cmp(&b.1).then_with(|| a.2.cmp(&b.2)))
Copy link
Author

Choose a reason for hiding this comment

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

Still use the number of txs as a backup comparison if the CUs happen to be exactly equal

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.1%. Comparing base (4ae2ca1) to head (f8d8109).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1221   +/-   ##
=======================================
  Coverage    82.1%    82.1%           
=======================================
  Files         886      886           
  Lines      236439   236453   +14     
=======================================
+ Hits       194252   194320   +68     
+ Misses      42187    42133   -54     

@apfitzge apfitzge requested a review from tao-stones May 7, 2024 17:05
@apfitzge apfitzge marked this pull request as ready for review May 7, 2024 17:05
Copy link

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

lgtm

@apfitzge apfitzge merged commit 41e2c96 into anza-xyz:master May 7, 2024
38 checks passed
@apfitzge apfitzge deleted the scheduler_cu_load_balance branch May 7, 2024 21:33
@apfitzge apfitzge added the v1.18 label May 9, 2024
Copy link

mergify bot commented May 9, 2024

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

mergify bot pushed a commit that referenced this pull request May 9, 2024
(cherry picked from commit 41e2c96)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants