diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-06 13:02:40 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-01-06 13:18:36 +0000 |
commit | a42f25f85f6708d75c4103d65a647d975c4c82b5 (patch) | |
tree | bcb0df2d6147b7a9ff5927a779f45890910dd9de /searchcore | |
parent | 7d839355259eca823da9396c1ed15b43f7c98768 (diff) |
Cap number of threads used per query at number of cores.
Diffstat (limited to 'searchcore')
5 files changed, 8 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index b97722493ab..6241af3fcf7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -206,7 +206,7 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, _replay_throttling_policy(std::make_unique<ReplayThrottlingPolicy>(make_replay_throttling_policy(protonCfg.replayThrottlingPolicy))), _config_store(std::move(config_store)), _metricsWireService(metricsWireService), - _metrics(_docTypeName.getName(), protonCfg.numthreadspersearch), + _metrics(_docTypeName.getName(), owner.getNumThreadsPerSearch()), _metricsHook(std::make_unique<MetricsUpdateHook>(*this)), _feedView(), _refCount(), diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentdbowner.h b/searchcore/src/vespa/searchcore/proton/server/idocumentdbowner.h index 36ac3427e66..2742e116308 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentdbowner.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentdbowner.h @@ -18,6 +18,7 @@ public: virtual bool isInitializing() const = 0; virtual uint32_t getDistributionKey() const = 0; + virtual uint32_t getNumThreadsPerSearch() const = 0; virtual SessionManager & session_manager() = 0; virtual std::shared_ptr<IDocumentDBReferenceRegistry> getDocumentDBReferenceRegistry() const = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index b9531786f10..184637c02cf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -262,6 +262,7 @@ Proton::Proton(FastOS_ThreadPool & threadPool, FNET_Transport & transport, const _compile_cache_executor_binding(), _queryLimiter(), _distributionKey(-1), + _numThreadsPerSearch(1), _isInitializing(true), _abortInit(false), _initStarted(false), @@ -295,6 +296,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) ensureWritableDir(protonConfig.basedir); const HwInfo & hwInfo = configSnapshot->getHwInfo(); _hw_info = hwInfo; + _numThreadsPerSearch = std::min(hwInfo.cpu().cores(), uint32_t(protonConfig.numthreadspersearch)); setBucketCheckSumType(protonConfig); setFS4Compression(protonConfig); @@ -304,7 +306,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) _metricsEngine->addMetricsHook(*_metricsHook); _fileHeaderContext.setClusterName(protonConfig.clustername, protonConfig.basedir); _matchEngine = std::make_unique<MatchEngine>(protonConfig.numsearcherthreads, - protonConfig.numthreadspersearch, + getNumThreadsPerSearch(), protonConfig.distributionkey, protonConfig.search.async); _matchEngine->set_issue_forwarding(protonConfig.forwardIssues); diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index 108adca9d83..bf84650867a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -122,6 +122,7 @@ private: vespalib::eval::CompileCache::ExecutorBinding::UP _compile_cache_executor_binding; matching::QueryLimiter _queryLimiter; uint32_t _distributionKey; + uint32_t _numThreadsPerSearch; bool _isInitializing; bool _abortInit; bool _initStarted; @@ -222,6 +223,7 @@ public: bool hasAbortedInit() const { return _abortInit; } storage::spi::PersistenceProvider & getPersistence(); + uint32_t getNumThreadsPerSearch() const override { return _numThreadsPerSearch; } void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; std::vector<vespalib::string> get_children_names() const override; diff --git a/searchcore/src/vespa/searchcore/proton/test/dummydbowner.h b/searchcore/src/vespa/searchcore/proton/test/dummydbowner.h index 99ccb0ab56d..84b9b9da655 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummydbowner.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummydbowner.h @@ -17,6 +17,7 @@ struct DummyDBOwner : IDocumentDBOwner { bool isInitializing() const override { return false; } uint32_t getDistributionKey() const override { return -1; } + uint32_t getNumThreadsPerSearch() const override { return 1; } std::shared_ptr<IDocumentDBReferenceRegistry> getDocumentDBReferenceRegistry() const override; SessionManager & session_manager() override; }; |