mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-09 17:14:47 +00:00
limit threadpool size in concurrent hash join
Signed-off-by: Duc Canh Le <duccanh.le@ahrefs.com>
This commit is contained in:
parent
cc165f9349
commit
11478b949f
@ -23,6 +23,7 @@
|
||||
#include <Common/scope_guard_safe.h>
|
||||
#include <Common/setThreadName.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Core/Settings.h>
|
||||
|
||||
namespace ProfileEvents
|
||||
{
|
||||
@ -81,11 +82,14 @@ ConcurrentHashJoin::ConcurrentHashJoin(
|
||||
: context(context_)
|
||||
, table_join(table_join_)
|
||||
, slots(toPowerOfTwo(std::min<UInt32>(static_cast<UInt32>(slots_), 256)))
|
||||
, max_threads(context->getSettingsRef().max_threads > 0 ? std::min(slots, context->getSettingsRef().max_threads.value) : slots)
|
||||
, pool(std::make_unique<ThreadPool>(
|
||||
CurrentMetrics::ConcurrentHashJoinPoolThreads,
|
||||
CurrentMetrics::ConcurrentHashJoinPoolThreadsActive,
|
||||
CurrentMetrics::ConcurrentHashJoinPoolThreadsScheduled,
|
||||
slots))
|
||||
/*max_threads_*/ max_threads,
|
||||
/*max_free_threads_*/ max_threads,
|
||||
/*queue_size_*/ slots))
|
||||
, stats_collecting_params(stats_collecting_params_)
|
||||
{
|
||||
hash_joins.resize(slots);
|
||||
|
@ -70,6 +70,7 @@ private:
|
||||
ContextPtr context;
|
||||
std::shared_ptr<TableJoin> table_join;
|
||||
size_t slots;
|
||||
size_t max_threads;
|
||||
std::unique_ptr<ThreadPool> pool;
|
||||
std::vector<std::shared_ptr<InternalHashJoin>> hash_joins;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user