Add scan thread token (#6443)

This commit is contained in:
Mingyu Chen
2021-08-27 10:56:17 +08:00
committed by GitHub
parent 4cfebc35a7
commit 3f2fdd236f
24 changed files with 349 additions and 105 deletions

View File

@ -91,8 +91,15 @@ Status ExecEnv::_init(const std::vector<StorePath>& store_paths) {
new ExtDataSourceServiceClientCache(config::max_client_cache_size_per_host);
_pool_mem_trackers = new PoolMemTrackerRegistry();
_thread_mgr = new ThreadResourceMgr();
_thread_pool = new PriorityThreadPool(config::doris_scanner_thread_pool_thread_num,
_scan_thread_pool = new PriorityThreadPool(config::doris_scanner_thread_pool_thread_num,
config::doris_scanner_thread_pool_queue_size);
ThreadPoolBuilder("LimitedScanThreadPool")
.set_min_threads(1)
.set_max_threads(config::doris_scanner_thread_pool_thread_num)
.set_max_queue_size(config::doris_scanner_thread_pool_queue_size)
.build(&_limited_scan_thread_pool);
_etl_thread_pool = new PriorityThreadPool(config::etl_thread_pool_size,
config::etl_thread_pool_queue_size);
_cgroups_mgr = new CgroupsMgr(this, config::doris_cgroups);
@ -233,7 +240,7 @@ void ExecEnv::_init_buffer_pool(int64_t min_page_size, int64_t capacity,
void ExecEnv::_register_metrics() {
REGISTER_HOOK_METRIC(scanner_thread_pool_queue_size, [this]() {
return _thread_pool->get_queue_size();
return _scan_thread_pool->get_queue_size();
});
REGISTER_HOOK_METRIC(etl_thread_pool_queue_size, [this]() {
@ -266,7 +273,7 @@ void ExecEnv::_destroy() {
SAFE_DELETE(_fold_constant_mgr);
SAFE_DELETE(_cgroups_mgr);
SAFE_DELETE(_etl_thread_pool);
SAFE_DELETE(_thread_pool);
SAFE_DELETE(_scan_thread_pool);
SAFE_DELETE(_thread_mgr);
SAFE_DELETE(_pool_mem_trackers);
SAFE_DELETE(_broker_client_cache);