-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[native] Default task.max-drivers-per-task to hardware concurrency #24642
[native] Default task.max-drivers-per-task to hardware concurrency #24642
Conversation
7faa001
to
765ca84
Compare
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.
LGTM! (docs)
Pull branch, local doc build, looks good. Thanks!
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.
Thanks for this!
@@ -76,21 +76,6 @@ std::string ConfigBase::capacityPropertyAsBytesString( | |||
velox::config::CapacityUnit::BYTE)); | |||
} | |||
|
|||
bool ConfigBase::registerProperty( |
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.
Thanks, looks like dead code.
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.
yes.
ASSERT_EQ(config.maxDriversPerTask(), 16); | ||
// std::thread::hardware_concurrency() value depends on the host. | ||
// Most hardware should have atleast 8 threads. | ||
ASSERT_GE(config.maxDriversPerTask(), 8); |
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.
Don't you want to not use 8 hard coded here but also read it from std::thread::hardware_concurrency()
and also to account for when this is 0?
We've run in all kinds of build envs so this could be a failure point.
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.
Good point!
5f3ba01
to
40a7405
Compare
"{} must be one of 'LEAF', 'INTERMEDIATE', or 'DEFAULT'", | ||
kPoolType); | ||
return value; | ||
static const std::unordered_set<std::string> kPoolTypes = { |
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.
format changes
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.
Thanks, looks good.
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.
Thanks @majetideepak. Small nit.
auto numThreads = std::thread::hardware_concurrency(); | ||
// The spec says std::thread::hardware_concurrency() might return 0. | ||
if (numThreads <= 0) { | ||
numThreads = 16; |
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.
Nit : Add static constant for this number.
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.
This function is in an anonymous namespace. I don't think there is any advantage of using a constant here. All the default config values use literals for example.
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.
@majetideepak : All of the SystemConfig property defaults are either in the registeredProps_ map (where static constant isn't needed) or they have individual SystemConfig functions to retrieve the properties if there is some logic like this which could use a default value. They aren't in anonymous namespace functions.
We should be consistent with that in general.
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.
Using an anonymous namespace is equivalent to using static. https://stackoverflow.com/questions/4422507/how-are-unnamed-namespaces-superior-to-the-static-keyword
I can add a constant.
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.
@majetideepak : Thanks for that article. Agree that we should reduce our use of static constants and functions as much as possible for external linkage.
Made the review comment largely because of consistency with the rest of this class.
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.
@aditi-pandit I ended up removing the constant. I added a check instead.
989f107
to
6dc3a20
Compare
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.
Thanks @majetideepak
@steveburnett Can you approve this again? Thanks. |
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.
LGTM! (docs)
Pull updated branch, new local doc build.
/// Registers an extra property in the config. | ||
/// Returns true if succeeded, false if failed (due to the property already | ||
/// registered). | ||
bool registerProperty( |
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.
Hey @majetideepak , why do we remove this? We still have usage of this function inside meta.
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.
In OSS, its unused. We should probably add some tests or at least leave a comment about its usage.
Description
The doc says task.max-drivers-per-task defaults to CPU count.
https://prestodb.io/docs/current/presto_cpp/properties.html#task-max-drivers-per-task
But it defaults to 16 in the code.
This config must default to the thread concurrency count for better user experience.
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.