Moved global_max_threads parameter from users.xml file to config.xml file

This commit is contained in:
Roman Vasin 2022-04-22 17:17:29 +03:00
parent 7c02bd75e3
commit 0c467872d9
4 changed files with 15 additions and 2 deletions

View File

@ -1107,6 +1107,9 @@ int Server::main(const std::vector<std::string> & /*args*/)
if (config->has("max_partition_size_to_drop"))
global_context->setMaxPartitionSizeToDrop(config->getUInt64("max_partition_size_to_drop"));
if (config->has("global_max_threads"))
global_context->getProcessList().setGlobalMaxThreads(config->getInt("global_max_threads", 0));
if (config->has("max_concurrent_queries"))
global_context->getProcessList().setMaxSize(config->getInt("max_concurrent_queries", 0));

View File

@ -47,7 +47,6 @@ class IColumn;
M(UInt64, max_insert_delayed_streams_for_parallel_write, 0, "The maximum number of streams (columns) to delay final part flush. Default - auto (1000 in case of underlying storage supports parallel write, for example S3 and disabled otherwise)", 0) \
M(UInt64, max_final_threads, 16, "The maximum number of threads to read from table with FINAL.", 0) \
M(MaxThreads, max_threads, 0, "The maximum number of threads to execute the request. By default, it is determined automatically.", 0) \
M(MaxThreads, global_max_threads, 0, "The total maximum number of threads for all requests.", 0) \
M(MaxThreads, max_download_threads, 4, "The maximum number of threads to download data (e.g. for URL engine).", 0) \
M(UInt64, max_download_buffer_size, 10*1024*1024, "The maximal size of buffer for parallel downloading (e.g. for URL engine) per each thread.", 0) \
M(UInt64, max_read_buffer_size, DBMS_DEFAULT_BUFFER_SIZE, "The maximum size of the buffer to read from the filesystem.", 0) \

View File

@ -301,6 +301,9 @@ protected:
Container processes;
size_t max_size = 0; /// 0 means no limit. Otherwise, when limit exceeded, an exception is thrown.
/// The total maximum number of threads for all requests.
size_t global_max_threads = 0; /// 0 means no limit.
/// Stores per-user info: queries, statistics and limits
UserToQueries user_to_queries;
@ -345,6 +348,14 @@ public:
/// Get total number of threads for all queries in process list.
size_t getGlobalNumThreads() const;
size_t getGlobalMaxThreads() const { return global_max_threads; }
void setGlobalMaxThreads(size_t global_max_threads_)
{
std::lock_guard lock(mutex);
global_max_threads = global_max_threads_;
}
/// Get current state of process list per user.
UserInfo getUserInfo(bool get_profile_events = false) const;

View File

@ -473,7 +473,7 @@ size_t QueryPipelineBuilder::getNumThreads() const
LOG_DEBUG(adqm_log,"Recommended num threads: {}", num_threads);
auto context = process_list_element->getContext();
auto global_max_threads = context->getSettingsRef().global_max_threads;
auto global_max_threads = context->getProcessList().getGlobalMaxThreads();
if (process_list_element && global_max_threads) {
LOG_DEBUG(adqm_log,"Global number of threads from config: {}", global_max_threads);
LOG_DEBUG(adqm_log,"Current global num threads: {}",