diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-01-25 09:51:04 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-01-25 09:51:04 +0000 |
commit | 9bc96b1c73a598b33cd82059f18fbcfffbd721a3 (patch) | |
tree | f2f02b543b9dbcf354316503dd0ba9cca608aeb8 /searchcore | |
parent | 03b14c66e80c38288a00deed91a0b7e0f10a2b06 (diff) |
Use hwInfo
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp | 7 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index 21a7336401c..a3cd4222a06 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -54,7 +54,8 @@ DocumentSubDBCollection::DocumentSubDBCollection( _retrievers(), _reprocessingRunner(), _bucketDB(), - _bucketDBHandler() + _bucketDBHandler(), + _hwInfo(hwInfo) { _bucketDB = std::make_shared<BucketDBOwner>(); _bucketDBHandler = std::make_unique<bucketdb::BucketDBHandler>(*_bucketDB); @@ -93,8 +94,8 @@ DocumentSubDBCollection::DocumentSubDBCollection( DocumentSubDBCollection::~DocumentSubDBCollection() { - size_t numCores = std::max(1u, std::thread::hardware_concurrency()); - vespalib::ThreadStackExecutor closePool(std::min(_subDBs.size(), numCores), 0x20000); + size_t numThreads = std::min(_subDBs.size(), static_cast<size_t>(_hwInfo.cpu().cores())); + vespalib::ThreadStackExecutor closePool(numThreads, 0x20000); while (!_subDBs.empty()) { closePool.execute(makeLambdaTask([subDB=_subDBs.back()]() { delete subDB; })); _subDBs.pop_back(); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index 68f790307ce..4f0e00c6ae5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -3,6 +3,7 @@ #include <vespa/searchcore/proton/reprocessing/reprocessingrunner.h> #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchcommon/common/growstrategy.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/vespalib/util/varholder.h> @@ -90,6 +91,7 @@ private: ReprocessingRunner _reprocessingRunner; std::shared_ptr<BucketDBOwner> _bucketDB; std::unique_ptr<bucketdb::BucketDBHandler> _bucketDBHandler; + HwInfo _hwInfo; public: DocumentSubDBCollection( |