summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-06-23 13:42:59 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-06-23 13:42:59 +0000
commit0b530096dcb0e30a3e4c3ea606ece5aef5955a97 (patch)
tree665ad4cf5f06268416deffc930beaa2a0b60d19b /searchcore
parent7c1985de6e9fcab0a67558b0d0ee9aa8073d44a2 (diff)
Add config control over feeding niceness
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/config/proton.def5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/shared_threading_service.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/shared_threading_service_config.h3
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..c8fac7fb40e 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. A large number means 'not less nice than a lower number'.
+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; }
};