From 32dce464ff14fe98b8b959b12f72a8553dd0e750 Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Wed, 20 Nov 2024 14:41:51 +0300 Subject: [PATCH] node: support reloading object pool sizes with SIGHUP Change sizes of the `replication` and `putRemote` pools. Refs #1770. Signed-off-by: Andrey Butusov --- CHANGELOG.md | 1 + cmd/neofs-node/config.go | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e199d4a5..91af124efc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ attribute, which is used for container domain name in NNS contracts (#2954) - `logger.encoding` config option (#2999) - Reloading morph endpoints with SIGHUP (#2998) - New `peapod-to-fstree` tool providing peapod-to-fstree data migration (#3013) +- Reloading pool sizes (#3018) ### Fixed - Do not search for tombstones when handling their expiration, use local indexes instead (#2929) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 4fb4bd9c9d..5c46fd52a8 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -477,7 +477,8 @@ type cfgObject struct { eaclSource container.EACLSource - pool cfgObjectRoutines + poolLock sync.RWMutex + pool cfgObjectRoutines cfgLocalStorage cfgLocalStorage @@ -770,6 +771,20 @@ func initObjectPool(cfg *config.Config) (pool cfgObjectRoutines) { return pool } +func (c *cfg) reloadObjectPoolSizes() { + c.cfgObject.poolLock.Lock() + defer c.cfgObject.poolLock.Unlock() + + c.cfgObject.pool.putRemoteCapacity = objectconfig.Put(c.cfgReader).PoolSizeRemote() + c.cfgObject.pool.putRemote.Tune(c.cfgObject.pool.putRemoteCapacity) + + c.cfgObject.pool.replicatorPoolSize = replicatorconfig.PoolSize(c.cfgReader) + if c.cfgObject.pool.replicatorPoolSize <= 0 { + c.cfgObject.pool.replicatorPoolSize = c.cfgObject.pool.putRemoteCapacity + } + c.cfgObject.pool.replication.Tune(c.cfgObject.pool.replicatorPoolSize) +} + func (c *cfg) LocalNodeInfo() (*netmapV2.NodeInfo, error) { var res netmapV2.NodeInfo c.cfgNodeInfo.localInfo.WriteToV2(&res) @@ -830,7 +845,7 @@ func (c *cfg) needBootstrap() bool { // It is calculated as size/capacity ratio of "remote object put" worker. // Returns float value between 0.0 and 1.0. func (c *cfg) ObjectServiceLoad() float64 { - return float64(c.cfgObject.pool.putRemote.Running()) / float64(c.cfgObject.pool.putRemoteCapacity) + return float64(c.cfgObject.pool.putRemote.Running()) / float64(c.cfgObject.pool.putRemote.Cap()) } func (c *cfg) configWatcher(ctx context.Context) { @@ -860,6 +875,10 @@ func (c *cfg) configWatcher(ctx context.Context) { c.shared.policer.Reload(c.policerOpts()...) + // Pool + + c.reloadObjectPoolSizes() + // Storage Engine var rcfg engine.ReConfiguration