diff options
author | Geir Storli <geirst@oath.com> | 2017-10-11 12:19:42 +0000 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2017-10-12 12:12:28 +0000 |
commit | 3dc13e6f5ef96379fbde2a5aff67bf07444be236 (patch) | |
tree | 9a241a8e0a2047ff71afe79485d8f2f8a694d173 /searchcore | |
parent | 86a15b5f9e6d998079fd684cdc2db75d9764992f (diff) |
Refactor to use ThreadingServiceConfig.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/documentdb.cpp | 23 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/documentdb.h | 17 |
2 files changed, 14 insertions, 26 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index ada2c1b1069..cffa014534e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -61,16 +61,7 @@ using searchcorespi::IFlushTarget; namespace proton { namespace { - constexpr uint32_t indexing_thread_stack_size = 128 * 1024; - -uint32_t semiUnboundTaskLimit(uint32_t semiUnboundExecutorTaskLimit, - uint32_t indexingThreads) -{ - uint32_t taskLimit = semiUnboundExecutorTaskLimit / indexingThreads; - return taskLimit; -} - } template <typename FunctionType> @@ -106,12 +97,10 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, _bucketSpace(bucketSpace), _baseDir(baseDir + "/" + _docTypeName.toString()), // Only one thread per executor, or performDropFeedView() will fail. - _defaultExecutorTaskLimit(protonCfg.indexing.tasklimit), - _semiUnboundExecutorTaskLimit(protonCfg.indexing.semiunboundtasklimit), - _indexingThreads(protonCfg.indexing.threads), - _writeService(std::max(1, protonCfg.indexing.threads), + _writeServiceConfig(ThreadingServiceConfig::make(protonCfg, hwInfo.cpu())), + _writeService(_writeServiceConfig.indexingThreads(), indexing_thread_stack_size, - _defaultExecutorTaskLimit), + _writeServiceConfig.defaultTaskLimit()), _initializeThreads(initializeThreads), _initConfigSnapshot(), _initConfigSerialNum(0u), @@ -181,7 +170,7 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, fastos::TimeStamp visibilityDelay = loaded_config->getMaintenanceConfigSP()->getVisibilityDelay(); _visibility.setVisibilityDelay(visibilityDelay); if (_visibility.getVisibilityDelay() > 0) { - _writeService.setTaskLimit(semiUnboundTaskLimit(_semiUnboundExecutorTaskLimit, _indexingThreads)); + _writeService.setTaskLimit(_writeServiceConfig.semiUnboundTaskLimit()); } } @@ -425,9 +414,9 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum _visibility.setVisibilityDelay(visibilityDelay); } if (_visibility.getVisibilityDelay() > 0) { - _writeService.setTaskLimit(semiUnboundTaskLimit(_semiUnboundExecutorTaskLimit, _indexingThreads)); + _writeService.setTaskLimit(_writeServiceConfig.semiUnboundTaskLimit()); } else { - _writeService.setTaskLimit(_defaultExecutorTaskLimit); + _writeService.setTaskLimit(_writeServiceConfig.defaultTaskLimit()); } if (params.shouldSubDbsChange() || hasVisibilityDelayChanged) { applySubDBConfig(*configSnapshot, serialNum, params); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index cd0335b7b75..e23cd78b3ad 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -5,20 +5,23 @@ #include "clusterstatehandler.h" #include "configstore.h" #include "ddbstate.h" +#include "disk_mem_usage_forwarder.h" #include "documentdbconfig.h" #include "documentsubdbcollection.h" +#include "executorthreadingservice.h" #include "feedhandler.h" +#include "i_document_db_config_owner.h" +#include "i_document_subdb_owner.h" #include "i_feed_handler_owner.h" #include "i_lid_space_compaction_handler.h" #include "ifeedview.h" #include "ireplayconfig.h" #include "maintenancecontroller.h" -#include "i_document_db_config_owner.h" -#include "executorthreadingservice.h" +#include "threading_service_config.h" #include "visibilityhandler.h" -#include "i_document_subdb_owner.h" -#include "disk_mem_usage_forwarder.h" +#include <vespa/metrics/updatehook.h> +#include <vespa/searchcore/proton/attribute/attribute_usage_filter.h> #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcore/proton/common/monitored_refcount.h> #include <vespa/searchcore/proton/metrics/documentdb_job_trackers.h> @@ -28,8 +31,6 @@ #include <vespa/searchlib/docstore/cachestats.h> #include <vespa/searchlib/transactionlog/syncproxy.h> #include <vespa/vespalib/util/varholder.h> -#include <vespa/searchcore/proton/attribute/attribute_usage_filter.h> -#include <vespa/metrics/updatehook.h> #include <mutex> #include <condition_variable> @@ -80,9 +81,7 @@ private: DocTypeName _docTypeName; document::BucketSpace _bucketSpace; vespalib::string _baseDir; - uint32_t _defaultExecutorTaskLimit; - uint32_t _semiUnboundExecutorTaskLimit; - uint32_t _indexingThreads; + ThreadingServiceConfig _writeServiceConfig; // Only one thread per executor, or dropFeedView() will fail. ExecutorThreadingService _writeService; // threads for initializer tasks during proton startup |