diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-06-24 12:18:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-24 12:18:19 +0200 |
commit | acd3b9c6149538dcb42970a4d358cb2a26294c15 (patch) | |
tree | d2e86ca0f5b2c9143a432f2312c44866af8b922a /searchcore | |
parent | a9249c4629131fa2bcf3c6e68793d455af812e93 (diff) | |
parent | 341f19fec3a6b8e9482862943846ee72966ab816 (diff) |
Merge pull request #23222 from vespa-engine/balder/add-configurable-feeding-niceness
Add config control over feeding niceness
Diffstat (limited to 'searchcore')
4 files changed, 14 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def index ffd9db2f58b..5829666c41b 100644 --- a/searchcore/src/vespa/searchcore/config/proton.def +++ b/searchcore/src/vespa/searchcore/config/proton.def @@ -483,6 +483,11 @@ hwinfo.cpu.cores int default = 0 restart ## See shared_threading_service_config.cpp for details on how the thread pool sizes are calculated. feeding.concurrency double default = 0.2 restart +## A number between 0.0 and 1.0 telling how nice the feed and background threads shall be. +## A value of 0.0, which is default, means 'not any nicer than anyone else'. +## The scale from 0.0 to 1.0 is not linear. It is OS specific. +feeding.niceness double default = 0.0 restart + ## Maximum number of pending tasks for the master thread in each document db. ## ## This limit is only considered when executing tasks for handling external feed operations. diff --git a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp index 86db96a20ac..5f522bfaffc 100644 --- a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp @@ -6,6 +6,7 @@ #include <vespa/vespalib/util/cpu_usage.h> #include <vespa/vespalib/util/sequencedtaskexecutor.h> #include <vespa/vespalib/util/size_literals.h> +#include <vespa/vespalib/util/nice.h> using vespalib::CpuUsage; using vespalib::steady_time; @@ -24,7 +25,7 @@ SharedThreadingService::SharedThreadingService(const SharedThreadingServiceConfi CpuUsage::wrap(proton_warmup_executor, CpuUsage::Category::COMPACT), cfg.shared_task_limit())), _shared(std::make_shared<vespalib::BlockingThreadStackExecutor>(cfg.shared_threads(), 128_Ki, - cfg.shared_task_limit(), proton_shared_executor)), + cfg.shared_task_limit(), vespalib::be_nice(proton_shared_executor, cfg.feeding_niceness()))), _field_writer(), _invokeService(std::max(vespalib::adjustTimeoutByDetectedHz(1ms), cfg.field_writer_config().reactionTime())), @@ -33,7 +34,7 @@ SharedThreadingService::SharedThreadingService(const SharedThreadingServiceConfi _clock(_invokeService.nowRef()) { const auto& fw_cfg = cfg.field_writer_config(); - _field_writer = vespalib::SequencedTaskExecutor::create(CpuUsage::wrap(proton_field_writer_executor, CpuUsage::Category::WRITE), + _field_writer = vespalib::SequencedTaskExecutor::create(vespalib::be_nice(CpuUsage::wrap(proton_field_writer_executor, CpuUsage::Category::WRITE), cfg.feeding_niceness()), cfg.field_writer_threads(), fw_cfg.defaultTaskLimit(), fw_cfg.is_task_limit_hard(), diff --git a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp index 002ac508b4a..50ef5039e75 100644 --- a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp @@ -12,11 +12,13 @@ SharedThreadingServiceConfig::SharedThreadingServiceConfig(uint32_t shared_threa uint32_t shared_task_limit_in, uint32_t warmup_threads_in, uint32_t field_writer_threads_in, + double feeding_niceness_in, const ThreadingServiceConfig& field_writer_config_in) : _shared_threads(shared_threads_in), _shared_task_limit(shared_task_limit_in), _warmup_threads(warmup_threads_in), _field_writer_threads(field_writer_threads_in), + _feeding_niceness(feeding_niceness_in), _field_writer_config(field_writer_config_in) { } @@ -61,6 +63,7 @@ SharedThreadingServiceConfig::make(const proton::SharedThreadingServiceConfig::P return proton::SharedThreadingServiceConfig(shared_threads, shared_threads * 16, derive_warmup_threads(cpu_info), field_writer_threads, + cfg.feeding.niceness, ThreadingServiceConfig::make(cfg)); } diff --git a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h index 5a2468ca1ab..add592f463d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h +++ b/searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h @@ -20,6 +20,7 @@ private: uint32_t _shared_task_limit; uint32_t _warmup_threads; uint32_t _field_writer_threads; + double _feeding_niceness; ThreadingServiceConfig _field_writer_config; public: @@ -27,6 +28,7 @@ public: uint32_t shared_task_limit_in, uint32_t warmup_threads_in, uint32_t field_writer_threads_in, + double feed_niceness_in, const ThreadingServiceConfig& field_writer_config_in); static SharedThreadingServiceConfig make(const ProtonConfig& cfg, const HwInfo::Cpu& cpu_info); @@ -35,6 +37,7 @@ public: uint32_t shared_task_limit() const { return _shared_task_limit; } uint32_t warmup_threads() const { return _warmup_threads; } uint32_t field_writer_threads() const { return _field_writer_threads; } + double feeding_niceness() const { return _feeding_niceness; } const ThreadingServiceConfig& field_writer_config() const { return _field_writer_config; } }; |