diff options
author | Geir Storli <geirst@oath.com> | 2017-10-11 12:41:11 +0000 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2017-10-12 12:12:38 +0000 |
commit | 0cd43f192b9c23973af5fe590f0f2ef235d97b8a (patch) | |
tree | 268f1d1ea9259a4b5ec06fda3cb2c7ade2de4285 | |
parent | 3dc13e6f5ef96379fbde2a5aff67bf07444be236 (diff) |
Derive compression/compaction threads based on cpu cores and feeding concurrency.
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/proton.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index 556743ad267..36f19c385f7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -85,12 +85,10 @@ diskMemUsageSamplerConfig(const ProtonConfig &proton, const HwInfo &hwInfo) } size_t -deriveBackgroundThreads(const ProtonConfig & proton) { - size_t threads = std::thread::hardware_concurrency(); - if (proton.background.threads != 0) { - threads = proton.background.threads; - } - threads = std::max(threads, size_t(proton.summary.log.numthreads)); +deriveCompactionCompressionThreads(const ProtonConfig &proton, + const HwInfo::Cpu &cpuInfo) { + size_t scaledCores = (size_t)std::ceil(cpuInfo.cores() * proton.feeding.concurrency); + size_t threads = std::max(scaledCores, size_t(proton.summary.log.numthreads)); // We need at least 1 guaranteed free worker in order to ensure progress so #documentsdbs + 1 should suffice, // but we will not be cheap and give #documentsdbs * 2 @@ -302,7 +300,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) vespalib::string fileConfigId; _warmupExecutor.reset(new vespalib::ThreadStackExecutor(4, 128*1024)); - const size_t summaryThreads = deriveBackgroundThreads(protonConfig); + const size_t summaryThreads = deriveCompactionCompressionThreads(protonConfig, _hwInfo.cpu()); _summaryExecutor.reset(new vespalib::BlockingThreadStackExecutor(summaryThreads, 128*1024, summaryThreads*16)); InitializeThreads initializeThreads; if (protonConfig.initialize.threads > 0) { |