diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-03-31 12:48:52 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-03-31 12:49:40 +0000 |
commit | f54e7e783af84b340726da16e74ea8e971e2956b (patch) | |
tree | 69f9315d02a6ca5b0b522eaf231f002b7b0b44f2 /searchcore | |
parent | 0834512ff94d7dfd3c9b7a65933346a2c9a61c3c (diff) |
Control dispatch of docusm and search requests separately.
Also let default be that backend selects suitable number of threads.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/config/proton.def | 11 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/server/proton.cpp | 21 |
2 files changed, 19 insertions, 13 deletions
diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def index aefd0c176a7..55dc036df63 100644 --- a/searchcore/src/vespa/searchcore/config/proton.def +++ b/searchcore/src/vespa/searchcore/config/proton.def @@ -20,11 +20,14 @@ partition int default=0 restart distributionkey int default=-1 ## Number of threads used for rpc transport threads -rpctransportthreads int default=4 restart +## A zero value will make the backend smart about the number. +rpc.transportthreads int default=0 restart -## Dispatch requests to threadpool -## If false, rpctransportthreads will be set to num cores -asyncsearch bool default=true +## Dispatch search requests to threadpool +search.async bool default=true + +## Dispatch docsum requests to threadpool +docsum.async bool default=true ## Num searcher threads numsearcherthreads int default=64 restart diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index 54012c4de51..1beb0a04de0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -109,8 +109,7 @@ diskMemUsageSamplerConfig(const ProtonConfig &proton, const HwInfo &hwInfo) } size_t -derive_shared_threads(const ProtonConfig &proton, - const HwInfo::Cpu &cpuInfo) { +derive_shared_threads(const ProtonConfig &proton, const HwInfo::Cpu &cpuInfo) { size_t scaledCores = (size_t)std::ceil(cpuInfo.cores() * proton.feeding.concurrency); // We need at least 1 guaranteed free worker in order to ensure progress so #documentsdbs + 1 should suffice, @@ -118,10 +117,14 @@ derive_shared_threads(const ProtonConfig &proton, return std::max(scaledCores, proton.documentdb.size() + proton.flush.maxconcurrent + 1); } -size_t -computeThreads(uint32_t minimum, uint32_t configured, const HwInfo::Cpu &cpuInfo) { - uint32_t threads = configured ? configured : cpuInfo.cores(); - return std::max(minimum, threads); +uint32_t +computeRpcTransportThreads(const ProtonConfig & cfg, const HwInfo::Cpu &cpuInfo) { + bool areSearchAndDocsumAsync = cfg.docsum.async && cfg.search.async; + return (cfg.rpc.transportthreads > 0) + ? cfg.rpc.transportthreads + : areSearchAndDocsumAsync + ? cpuInfo.cores()/8 + : cpuInfo.cores(); } struct MetricsUpdateHook : metrics::UpdateHook @@ -288,9 +291,9 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) _matchEngine = std::make_unique<MatchEngine>(protonConfig.numsearcherthreads, protonConfig.numthreadspersearch, protonConfig.distributionkey, - protonConfig.asyncsearch); + protonConfig.search.async); _distributionKey = protonConfig.distributionkey; - _summaryEngine= std::make_unique<SummaryEngine>(protonConfig.numsummarythreads, protonConfig.asyncsearch); + _summaryEngine= std::make_unique<SummaryEngine>(protonConfig.numsummarythreads, protonConfig.docsum.async); _docsumBySlime = std::make_unique<DocsumBySlime>(*_summaryEngine); IFlushStrategy::SP strategy; @@ -342,7 +345,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) _prepareRestartHandler = std::make_unique<PrepareRestartHandler>(*_flushEngine); RPCHooks::Params rpcParams(*this, protonConfig.rpcport, _configUri.getConfigId(), - computeThreads(2, protonConfig.rpctransportthreads, hwInfo.cpu()), + std::max(2u, computeRpcTransportThreads(protonConfig, hwInfo.cpu())), std::max(2u, hwInfo.cpu().cores()/4)); rpcParams.slobrok_config = _configUri.createWithNewId(protonConfig.slobrokconfigid); _rpcHooks = std::make_unique<RPCHooks>(rpcParams); |