-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add --unified-scheduler-handler-threads #35195
Conversation
083971a
to
5036047
Compare
let handler_count = handler_count.unwrap_or(1); | ||
// we're hard-coding the number of handler thread to 1, meaning this impl is currently | ||
// single-threaded still. | ||
assert_eq!(handler_count, 1); // replace this with assert!(handler_count >= 1) later | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, --unified-scheduler-handler-threads
is meaningless for now.
(diff would be a lot clearer if i had more foresight at #34676..)
Arg::with_name("unified_scheduler_handler_threads") | ||
.long("unified-scheduler-handler-threads") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outside unified-scheduler-pool
code, i think handler thread count
is too verbose and impl-oriented naming. so, I used handler threads
intentionally. Also note that there's bunch of --*-threads
cli flags in solana-validator
as precedents. so, ending at -treads
should be no-brainer.
on the other hand, handler
is left for technical rigidness, because there's additional thread scScheduler
, which are created for each scheduler. and the thread doesn't count towards to unified-scheduler-handler-threads
.
Arg::with_name("unified_scheduler_handler_threads") | ||
.long("unified-scheduler-handler-threads") | ||
.value_name("COUNT") | ||
.takes_value(true) | ||
.validator(|s| is_within_range(s, 1..)) | ||
.global(true) | ||
.hidden(hidden_unless_forced()) | ||
.help(DefaultSchedulerPool::cli_message()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the actual builder method invocation order and lack of .global(true)
are the subtle differences from the solana-validator
counterpart. however, this is my best attempt to be consistent within respective surrounding convention (btw, hard to see consistencies in each places; they're already inconsistent, thus this is my arbitrary best effort)...
|
||
MESSAGE.get_or_init(|| { | ||
format!( | ||
"Change the number of the unified scheduler's transaction execution threads \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while i'm leaving impl jargon (handler
) inside the cli flag name, I intentionally avoided to use the word handler in this cli message, instead using the phrase transaction execution threads. That's my habit for achieving both grep
-ablity and rephrase-based quick introduction of unfamiliar words (= the handler in the cli flag) for human.
MESSAGE.get_or_init(|| { | ||
format!( | ||
"Change the number of the unified scheduler's transaction execution threads \ | ||
dedicated to each block, otherwise calculated as cpu_cores/4 [default: {}]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dedicated to each block
has rather important significance here to avoid misunderstanding of this number being the global thread count inside the whole solana-validator
process.
also, this whole message is specifically worded to put other calculated as cpu_cores/4
at the end of this message, so that it's lexically close enough to the actual default value.
a55af13
to
61dce27
Compare
.long("unified-scheduler-handler-threads") | ||
.value_name("COUNT") | ||
.takes_value(true) | ||
.validator(|s| is_within_range(s, 1..)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought about introducing some sensible upper bound like 1024, but opted not to do so because this flag doesn't need to be friendly that much and that restriction would hamper some pathological stress testing (again, this isn't strong point, as this is veerry niche & hypothetical use case).
} | ||
|
||
pub fn cli_message() -> &'static str { | ||
static MESSAGE: OnceLock<String> = OnceLock::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
back into the very beginnings of this looong unified scheduler journey, OnceLock
hasn't been stabilized yet.. ;) ref: #30746 (review)
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #35195 +/- ##
=========================================
- Coverage 81.6% 81.6% -0.1%
=========================================
Files 833 833
Lines 224827 224863 +36
=========================================
+ Hits 183523 183547 +24
- Misses 41304 41316 +12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cli arg(s) lgtm - feels a bit odd to introduce a new CLI argument that will cause the code to break if you actually use it, even if it is hidden. I know the impl is coming shortly, so I don't want to block your work.
* Add --unified-scheduler-handler-threads * Adjust value name * Warn if the flag was ignored * Tweak message a bit
Problem
There's no way to adjust the number of threads via cli for unified scheduler because it's still single-threaded. However, this won't hold eternally. :)
Summary of Changes
Provide such a way in advance for upcoming pr, which makes the unified scheduler multi-threaded with actual scheduler logic.
--help
(note: both output is identical)
context
extracted from #33070