summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/vespa/searchcore/config/proton.def3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h10
4 files changed, 23 insertions, 7 deletions
diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def
index 9ae15bd919e..4eac1552ec6 100644
--- a/searchcore/src/vespa/searchcore/config/proton.def
+++ b/searchcore/src/vespa/searchcore/config/proton.def
@@ -19,6 +19,9 @@ partition int default=0 restart
## Distribution key
distributionkey int default=-1
+## Number of threads used for rpc transport threads
+rpctransportthreads int default=4 restart
+
## 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 103805a41cd..8a2053eb683 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -118,6 +118,12 @@ 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);
+}
+
struct MetricsUpdateHook : metrics::UpdateHook
{
Proton &self;
@@ -335,6 +341,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, hwInfo.cpu().cores()/4));
rpcParams.slobrok_config = _configUri.createWithNewId(protonConfig.slobrokconfigid);
_rpcHooks = std::make_unique<RPCHooks>(rpcParams);
diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
index bc8cc7c55c9..62109eda98d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
@@ -177,12 +177,14 @@ RPCHooksBase::initRPC()
}
-RPCHooksBase::Params::Params(Proton &parent, uint32_t port, const vespalib::string &ident, uint32_t numThreads)
+RPCHooksBase::Params::Params(Proton &parent, uint32_t port, const vespalib::string &ident,
+ uint32_t transportThreads, uint32_t executorThreads)
: proton(parent),
slobrok_config(config::ConfigUri("admin/slobrok.0")),
identity(ident),
rtcPort(port),
- numRpcThreads(numThreads)
+ numTranportThreads(transportThreads),
+ numDocsumRpcThreads(executorThreads)
{ }
RPCHooksBase::Params::~Params() = default;
@@ -190,7 +192,7 @@ RPCHooksBase::Params::~Params() = default;
RPCHooksBase::RPCHooksBase(Params &params)
: _proton(params.proton),
_docsumByRPC(std::make_unique<DocsumByRPC>(_proton.getDocsumBySlime())),
- _transport(std::make_unique<FNET_Transport>(2)),
+ _transport(std::make_unique<FNET_Transport>(params.numTranportThreads)),
_orb(std::make_unique<FRT_Supervisor>(_transport.get())),
_proto_rpc_adapter(std::make_unique<ProtoRpcAdapter>(
_proton.get_search_server(),
@@ -199,7 +201,7 @@ RPCHooksBase::RPCHooksBase(Params &params)
_regAPI(*_orb, slobrok::ConfiguratorFactory(params.slobrok_config)),
_stateLock(),
_stateCond(),
- _executor(params.numRpcThreads, 128_Ki, proton_rpc_executor)
+ _executor(params.numDocsumRpcThreads, 128_Ki, proton_rpc_executor)
{ }
void
diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h
index 8e3679d8fa5..4bba2752867 100644
--- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h
+++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.h
@@ -86,9 +86,13 @@ public:
config::ConfigUri slobrok_config;
vespalib::string identity;
uint32_t rtcPort;
- uint32_t numRpcThreads;
+ uint32_t numTranportThreads;
+ // TODO: This can be eliminated and reduced to a fixed low number once old rpc has been removed from the qrs.
+ // Or even use the shared executor
+ uint32_t numDocsumRpcThreads;
- Params(Proton &parent, uint32_t port, const vespalib::string &ident, uint32_t numRpcThreads);
+ Params(Proton &parent, uint32_t port, const vespalib::string &ident,
+ uint32_t numTransportThreads, uint32_t numDocsumRpcThreads);
~Params();
};
RPCHooksBase(const RPCHooksBase &) = delete;
@@ -96,7 +100,7 @@ public:
RPCHooksBase(Params &params);
auto &proto_rpc_adapter_metrics() { return _proto_rpc_adapter->metrics(); }
void set_online();
- virtual ~RPCHooksBase();
+ ~RPCHooksBase() override;
void close();
void rpc_GetState(FRT_RPCRequest *req);