-
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
Changes from all commits
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 |
---|---|---|
|
@@ -37,6 +37,15 @@ std::string bool2String(bool value) { | |
return value ? "true" : "false"; | ||
} | ||
|
||
int getThreadCount() { | ||
auto numThreads = std::thread::hardware_concurrency(); | ||
// The spec says std::thread::hardware_concurrency() might return 0. | ||
// But we depend on std::thread::hardware_concurrency() to create executors. | ||
// Check to ensure numThreads is > 0. | ||
VELOX_CHECK_GT(numThreads, 0); | ||
return numThreads; | ||
} | ||
|
||
#define STR_PROP(_key_, _val_) \ | ||
{ std::string(_key_), std::string(_val_) } | ||
#define NUM_PROP(_key_, _val_) \ | ||
|
@@ -76,21 +85,6 @@ std::string ConfigBase::capacityPropertyAsBytesString( | |
velox::config::CapacityUnit::BYTE)); | ||
} | ||
|
||
bool ConfigBase::registerProperty( | ||
const std::string& propertyName, | ||
const folly::Optional<std::string>& defaultValue) { | ||
if (registeredProps_.count(propertyName) != 0) { | ||
PRESTO_STARTUP_LOG(WARNING) | ||
<< "Property '" << propertyName | ||
<< "' is already registered with default value '" | ||
<< registeredProps_[propertyName].value_or("<none>") << "'."; | ||
return false; | ||
} | ||
|
||
registeredProps_[propertyName] = defaultValue; | ||
return true; | ||
} | ||
|
||
folly::Optional<std::string> ConfigBase::setValue( | ||
const std::string& propertyName, | ||
const std::string& value) { | ||
|
@@ -138,7 +132,7 @@ SystemConfig::SystemConfig() { | |
BOOL_PROP(kHttpServerReusePort, false), | ||
BOOL_PROP(kHttpServerBindToNodeInternalAddressOnlyEnabled, false), | ||
NONE_PROP(kDiscoveryUri), | ||
NUM_PROP(kMaxDriversPerTask, 16), | ||
NUM_PROP(kMaxDriversPerTask, getThreadCount()), | ||
NONE_PROP(kTaskWriterCount), | ||
NONE_PROP(kTaskPartitionedWriterCount), | ||
NUM_PROP(kConcurrentLifespansPerTask, 1), | ||
|
@@ -292,14 +286,16 @@ std::string SystemConfig::prestoVersion() const { | |
} | ||
|
||
std::string SystemConfig::poolType() const { | ||
static const std::unordered_set<std::string> kPoolTypes = {"LEAF", "INTERMEDIATE", "DEFAULT"}; | ||
static constexpr std::string_view kPoolTypeDefault = "DEFAULT"; | ||
auto value = optionalProperty<std::string>(kPoolType).value_or(std::string(kPoolTypeDefault)); | ||
VELOX_USER_CHECK( | ||
kPoolTypes.count(value), | ||
"{} 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 commentThe reason will be displayed to describe this comment to others. Learn more. format changes |
||
"LEAF", "INTERMEDIATE", "DEFAULT"}; | ||
static constexpr std::string_view kPoolTypeDefault = "DEFAULT"; | ||
auto value = optionalProperty<std::string>(kPoolType).value_or( | ||
std::string(kPoolTypeDefault)); | ||
VELOX_USER_CHECK( | ||
kPoolTypes.count(value), | ||
"{} must be one of 'LEAF', 'INTERMEDIATE', or 'DEFAULT'", | ||
kPoolType); | ||
return value; | ||
} | ||
|
||
bool SystemConfig::mutableConfig() const { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,13 +42,6 @@ class ConfigBase { | |
config_ = std::move(config); | ||
} | ||
|
||
/// 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 commentThe 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 commentThe 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. |
||
const std::string& propertyName, | ||
const folly::Optional<std::string>& defaultValue = {}); | ||
|
||
/// Adds or replaces value at the given key. Can be used by debugging or | ||
/// testing code. | ||
/// Returns previous value if there was any. | ||
|
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.