Skip to content

Commit

Permalink
node: support reloading object pool sizes with SIGHUP
Browse files Browse the repository at this point in the history
Change sizes of the `replication` and `putRemote` pools.

Refs #1770.

Signed-off-by: Andrey Butusov <[email protected]>
  • Loading branch information
End-rey committed Nov 21, 2024
1 parent d0c8059 commit 32dce46
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 21 additions & 2 deletions cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ type cfgObject struct {

eaclSource container.EACLSource

pool cfgObjectRoutines
poolLock sync.RWMutex
pool cfgObjectRoutines

cfgLocalStorage cfgLocalStorage

Expand Down Expand Up @@ -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)

Check warning on line 785 in cmd/neofs-node/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/config.go#L774-L785

Added lines #L774 - L785 were not covered by tests
}

func (c *cfg) LocalNodeInfo() (*netmapV2.NodeInfo, error) {
var res netmapV2.NodeInfo
c.cfgNodeInfo.localInfo.WriteToV2(&res)
Expand Down Expand Up @@ -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())

Check warning on line 848 in cmd/neofs-node/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/config.go#L848

Added line #L848 was not covered by tests
}

func (c *cfg) configWatcher(ctx context.Context) {
Expand Down Expand Up @@ -860,6 +875,10 @@ func (c *cfg) configWatcher(ctx context.Context) {

c.shared.policer.Reload(c.policerOpts()...)

// Pool

c.reloadObjectPoolSizes()

Check warning on line 881 in cmd/neofs-node/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/config.go#L878-L881

Added lines #L878 - L881 were not covered by tests
// Storage Engine

var rcfg engine.ReConfiguration
Expand Down

0 comments on commit 32dce46

Please sign in to comment.