summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp22
-rw-r--r--vespalib/src/tests/singleexecutor/singleexecutor_test.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/singleexecutor.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/util/singleexecutor.h1
4 files changed, 14 insertions, 15 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
index f218193c02f..4798ebd8fbc 100644
--- a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
@@ -9,6 +9,7 @@
#include <vespa/vespalib/util/singleexecutor.h>
using vespalib::BlockingThreadStackExecutor;
+using vespalib::ThreadStackExecutor;
using vespalib::CpuUsage;
using vespalib::SequencedTaskExecutor;
using vespalib::SingleExecutor;
@@ -21,12 +22,17 @@ namespace proton {
namespace {
std::unique_ptr<SyncableThreadExecutor>
-createExecutorWithOneThread(uint32_t taskLimit, OptimizeFor optimize,
- vespalib::Runnable::init_fun_t init_function) {
- if (optimize == OptimizeFor::THROUGHPUT) {
- return std::make_unique<SingleExecutor>(std::move(init_function), taskLimit);
+createExecutorWithOneThread(const ThreadingServiceConfig & cfg, vespalib::Runnable::init_fun_t init_function) {
+ uint32_t taskLimit = cfg.defaultTaskLimit();
+ if (cfg.optimize() == OptimizeFor::THROUGHPUT) {
+ uint32_t watermark = (cfg.kindOfwatermark() == 0) ? taskLimit / 10 : cfg.kindOfwatermark();
+ return std::make_unique<SingleExecutor>(std::move(init_function), taskLimit, cfg.is_task_limit_hard(), watermark, 100ms);
} else {
- return std::make_unique<BlockingThreadStackExecutor>(1, taskLimit, std::move(init_function));
+ if (cfg.is_task_limit_hard()) {
+ return std::make_unique<BlockingThreadStackExecutor>(1, taskLimit, std::move(init_function));
+ } else {
+ return std::make_unique<ThreadStackExecutor>(1, std::move(init_function));
+ }
}
}
@@ -55,10 +61,8 @@ ExecutorThreadingService::ExecutorThreadingService(vespalib::Executor & sharedEx
_clock(clock),
_masterExecutor(1, CpuUsage::wrap(master_executor, CpuUsage::Category::WRITE)),
_master_task_limit(cfg.master_task_limit()),
- _indexExecutor(createExecutorWithOneThread(cfg.defaultTaskLimit(), cfg.optimize(),
- CpuUsage::wrap(index_executor, CpuUsage::Category::WRITE))),
- _summaryExecutor(createExecutorWithOneThread(cfg.defaultTaskLimit(), cfg.optimize(),
- CpuUsage::wrap(summary_executor, CpuUsage::Category::WRITE))),
+ _indexExecutor(createExecutorWithOneThread(cfg, CpuUsage::wrap(index_executor, CpuUsage::Category::WRITE))),
+ _summaryExecutor(createExecutorWithOneThread(cfg, CpuUsage::wrap(summary_executor, CpuUsage::Category::WRITE))),
_masterService(_masterExecutor),
_indexService(*_indexExecutor),
_index_field_inverter(field_writer),
diff --git a/vespalib/src/tests/singleexecutor/singleexecutor_test.cpp b/vespalib/src/tests/singleexecutor/singleexecutor_test.cpp
index 3b1d244eb13..23b2dd19a85 100644
--- a/vespalib/src/tests/singleexecutor/singleexecutor_test.cpp
+++ b/vespalib/src/tests/singleexecutor/singleexecutor_test.cpp
@@ -15,7 +15,7 @@ VESPA_THREAD_STACK_TAG(sequenced_executor)
TEST("test that all tasks are executed") {
std::atomic<uint64_t> counter(0);
- SingleExecutor executor(sequenced_executor, 10);
+ SingleExecutor executor(sequenced_executor, 10, true, 1, 100ms);
for (uint64_t i(0); i < 10; i++) {
executor.execute(makeLambdaTask([&counter] {counter++;}));
diff --git a/vespalib/src/vespa/vespalib/util/singleexecutor.cpp b/vespalib/src/vespa/vespalib/util/singleexecutor.cpp
index fa1aef61167..533fd293f71 100644
--- a/vespalib/src/vespa/vespalib/util/singleexecutor.cpp
+++ b/vespalib/src/vespa/vespalib/util/singleexecutor.cpp
@@ -6,10 +6,6 @@
namespace vespalib {
-SingleExecutor::SingleExecutor(init_fun_t func, uint32_t taskLimit)
- : SingleExecutor(func, taskLimit, true, taskLimit/10, 100ms)
-{ }
-
SingleExecutor::SingleExecutor(init_fun_t func, uint32_t reservedQueueSize, bool isQueueSizeHard, uint32_t watermark, duration reactionTime)
: _watermarkRatio(watermark < reservedQueueSize ? double(watermark) / reservedQueueSize : 1.0),
_taskLimit(vespalib::roundUp2inN(reservedQueueSize)),
diff --git a/vespalib/src/vespa/vespalib/util/singleexecutor.h b/vespalib/src/vespa/vespalib/util/singleexecutor.h
index e8b7b0c44ad..975202aa38b 100644
--- a/vespalib/src/vespa/vespalib/util/singleexecutor.h
+++ b/vespalib/src/vespa/vespalib/util/singleexecutor.h
@@ -22,7 +22,6 @@ namespace vespalib {
*/
class SingleExecutor final : public vespalib::SyncableThreadExecutor, vespalib::Runnable {
public:
- SingleExecutor(init_fun_t func, uint32_t reservedQueueSize);
SingleExecutor(init_fun_t func, uint32_t reservedQueueSize, bool isQueueSizeHard, uint32_t watermark, duration reactionTime);
~SingleExecutor() override;
Task::UP execute(Task::UP task) override;