-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Path workers, allow node operators to configure threads used #6667
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
base: develop
Are you sure you want to change the base?
Changes from all commits
e67e123
a1ef121
0b75412
8302426
4c285c7
c6eb05e
a554569
9aa2564
0a4023a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -705,6 +705,14 @@ Config::loadFromString(std::string const& fileContents) | |||||||||||||||||
| PATH_SEARCH_FAST = beast::lexicalCastThrow<int>(strTemp); | ||||||||||||||||||
| if (getSingleSection(secConfig, SECTION_PATH_SEARCH_MAX, strTemp, j_)) | ||||||||||||||||||
| PATH_SEARCH_MAX = beast::lexicalCastThrow<int>(strTemp); | ||||||||||||||||||
| if (getSingleSection(secConfig, SECTION_PATH_WORKERS, strTemp, j_)) | ||||||||||||||||||
| { | ||||||||||||||||||
| PATH_WORKERS = beast::lexicalCastThrow<int>(strTemp); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (PATH_WORKERS < 2) | ||||||||||||||||||
| Throw<std::runtime_error>("Invalid " SECTION_PATH_WORKERS | ||||||||||||||||||
| ": must be greater than or equal to 2."); | ||||||||||||||||||
| } | ||||||||||||||||||
|
Comment on lines
+708
to
+715
|
||||||||||||||||||
|
|
||||||||||||||||||
| if (getSingleSection(secConfig, SECTION_DEBUG_LOGFILE, strTemp, j_)) | ||||||||||||||||||
| DEBUG_LOGFILE = strTemp; | ||||||||||||||||||
|
|
@@ -731,6 +739,32 @@ Config::loadFromString(std::string const& fileContents) | |||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| auto const effectiveWorkers = [&]() { | ||||||||||||||||||
| if (standalone() && !FORCE_MULTI_THREAD) | ||||||||||||||||||
| return 1; | ||||||||||||||||||
|
|
||||||||||||||||||
| if (WORKERS) | ||||||||||||||||||
| return WORKERS; | ||||||||||||||||||
|
|
||||||||||||||||||
| auto count = static_cast<int>(std::thread::hardware_concurrency()); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (NODE_SIZE >= 4 && count >= 16) | ||||||||||||||||||
| count = 6 + std::min(count, 8); | ||||||||||||||||||
| else if (NODE_SIZE >= 3 && count >= 8) | ||||||||||||||||||
| count = 4 + std::min(count, 6); | ||||||||||||||||||
| else | ||||||||||||||||||
| count = 2 + std::min(count, 4); | ||||||||||||||||||
|
|
||||||||||||||||||
| return count; | ||||||||||||||||||
| }(); | ||||||||||||||||||
|
Comment on lines
+742
to
+759
|
||||||||||||||||||
|
|
||||||||||||||||||
| auto const maxUpdatePfLimit = std::max(2, (effectiveWorkers * 3) / 4); | ||||||||||||||||||
| if (PATH_WORKERS > maxUpdatePfLimit) | ||||||||||||||||||
| Throw<std::runtime_error>( | ||||||||||||||||||
| "Invalid " SECTION_PATH_WORKERS | ||||||||||||||||||
| ": must be less than or equal to 3/4 of effective job queue " | ||||||||||||||||||
| "workers (minimum maximum of 2)."); | ||||||||||||||||||
|
Comment on lines
+763
to
+766
|
||||||||||||||||||
| Throw<std::runtime_error>( | |
| "Invalid " SECTION_PATH_WORKERS | |
| ": must be less than or equal to 3/4 of effective job queue " | |
| "workers (minimum maximum of 2)."); | |
| Throw<std::runtime_error>(boost::str(boost::format( | |
| "Invalid %1%: configured value %2% exceeds maximum %3% " | |
| "(3/4 of effective job queue workers = %4%, minimum maximum of 2).") % | |
| SECTION_PATH_WORKERS % PATH_WORKERS % maxUpdatePfLimit % effectiveWorkers)); |
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 example config says the maximum is “3/4 of [workers]”, but the code enforces the limit against the effective job-queue worker count (which is auto-derived when
[workers]isn’t explicitly set). To avoid misleading operators, consider documenting that the cap is based on the effective worker count (explicit[workers]or the auto-selected default).