summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-04-05 18:46:54 +0200
committerGitHub <noreply@github.com>2020-04-05 18:46:54 +0200
commitda9a1fe368c0a3dfe3e2b64cfcd42034d39f4d45 (patch)
treee7a6625caf9ab859cbb55ff7e1cc0a18842e9d67
parent40b7aa999fdcea3d0362daf0c33d6b6592481f7a (diff)
Revert "Balder/control naptime"
-rw-r--r--messagebus/src/vespa/messagebus/network/rpcnetwork.cpp2
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp13
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/singleexecutor.h3
-rw-r--r--storage/src/vespa/storage/config/stor-communicationmanager.def4
4 files changed, 6 insertions, 16 deletions
diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp
index e049e436d03..e77664b0987 100644
--- a/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp
+++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.cpp
@@ -87,7 +87,7 @@ createExecutor(RPCNetworkParams::OptimizeFor optimizeFor) {
return std::make_unique<vespalib::ThreadStackExecutor>(1, 0x10000);
case RPCNetworkParams::OptimizeFor::THROUGHPUT:
default:
- return std::make_unique<vespalib::SingleExecutor>(1000, 10, 1ms);
+ return std::make_unique<vespalib::SingleExecutor>(100);
}
}
diff --git a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp
index 6492c301fe5..90eb18c23ef 100644
--- a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.cpp
@@ -6,10 +6,6 @@
namespace vespalib {
SingleExecutor::SingleExecutor(uint32_t taskLimit)
- : SingleExecutor(taskLimit, taskLimit/10, 5ms)
-{ }
-
-SingleExecutor::SingleExecutor(uint32_t taskLimit, uint32_t watermark, duration napTime)
: _taskLimit(vespalib::roundUp2inN(taskLimit)),
_wantedTaskLimit(_taskLimit.load()),
_rp(0),
@@ -23,13 +19,10 @@ SingleExecutor::SingleExecutor(uint32_t taskLimit, uint32_t watermark, duration
_wakeupConsumerAt(0),
_producerNeedWakeupAt(0),
_wp(0),
- _watermark(watermark),
- _napTime(napTime),
_closed(false)
{
_thread.start();
}
-
SingleExecutor::~SingleExecutor() {
shutdown();
sync();
@@ -109,10 +102,10 @@ SingleExecutor::run() {
while (!_thread.stopped()) {
drain_tasks();
_producerCondition.notify_all();
- _wakeupConsumerAt.store(_wp.load(std::memory_order_relaxed) + _watermark, std::memory_order_relaxed);
+ _wakeupConsumerAt.store(_wp.load(std::memory_order_relaxed) + (_taskLimit.load(std::memory_order_relaxed) / 4), std::memory_order_relaxed);
Lock lock(_mutex);
if (numTasks() <= 0) {
- _consumerCondition.wait_for(lock, _napTime);
+ _consumerCondition.wait_for(lock, 10ms);
}
_wakeupConsumerAt.store(0, std::memory_order_relaxed);
}
@@ -151,7 +144,7 @@ SingleExecutor::wait_for_room(Lock & lock) {
}
_queueSize.add(numTasks());
while (numTasks() >= _taskLimit.load(std::memory_order_relaxed)) {
- sleepProducer(lock, _napTime, wp - _watermark);
+ sleepProducer(lock, 10ms, wp - taskLimit/4);
}
}
diff --git a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
index cb78f8448f4..3d759769ea3 100644
--- a/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
+++ b/staging_vespalib/src/vespa/vespalib/util/singleexecutor.h
@@ -19,7 +19,6 @@ namespace vespalib {
class SingleExecutor final : public vespalib::SyncableThreadExecutor, vespalib::Runnable {
public:
explicit SingleExecutor(uint32_t taskLimit);
- SingleExecutor(uint32_t taskLimit, uint32_t watermark, duration napTime);
~SingleExecutor() override;
Task::UP execute(Task::UP task) override;
void setTaskLimit(uint32_t taskLimit) override;
@@ -57,8 +56,6 @@ private:
std::atomic<uint64_t> _wakeupConsumerAt;
std::atomic<uint64_t> _producerNeedWakeupAt;
std::atomic<uint64_t> _wp;
- const uint32_t _watermark;
- const duration _napTime;
bool _closed;
};
diff --git a/storage/src/vespa/storage/config/stor-communicationmanager.def b/storage/src/vespa/storage/config/stor-communicationmanager.def
index e0f2e89fa9d..0bc3f67f9c3 100644
--- a/storage/src/vespa/storage/config/stor-communicationmanager.def
+++ b/storage/src/vespa/storage/config/stor-communicationmanager.def
@@ -35,9 +35,9 @@ mbus.num_network_threads int default=2
## Number of workers threads for messagebus.
## Any value below 1 will be 1.
-mbus.num_threads int default=1
+mbus.num_threads int default=2
-mbus.optimize_for enum {LATENCY, THROUGHPUT} default = THROUGHPUT
+mbus.optimize_for enum {LATENCY, THROUGHPUT} default = LATENCY
## Enable to use above thread pool for encoding replies
## False will use network(fnet) thread