diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index 5af37865f..88ab21060 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -118,6 +118,7 @@ type applicationConfiguration struct { shardPoolSize uint32 shards []shardCfg lowMem bool + inhumePoolSize uint32 } // if need to run node in compatibility with other versions mode @@ -249,6 +250,7 @@ func (a *applicationConfiguration) readConfig(c *config.Config) error { a.EngineCfg.errorThreshold = engineconfig.ShardErrorThreshold(c) a.EngineCfg.shardPoolSize = engineconfig.ShardPoolSize(c) a.EngineCfg.lowMem = engineconfig.EngineLowMemoryConsumption(c) + a.EngineCfg.inhumePoolSize = engineconfig.InhumePoolSize(c) return engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error { return a.updateShardConfig(c, sc) }) } @@ -881,6 +883,7 @@ func (c *cfg) engineOpts() []engine.Option { engine.WithErrorThreshold(c.EngineCfg.errorThreshold), engine.WithLogger(c.log), engine.WithLowMemoryConsumption(c.EngineCfg.lowMem), + engine.WithInhumePoolSize(c.EngineCfg.inhumePoolSize), ) if c.metricsCollector != nil { diff --git a/cmd/frostfs-node/config/engine/config.go b/cmd/frostfs-node/config/engine/config.go index c944d1c58..da33bd372 100644 --- a/cmd/frostfs-node/config/engine/config.go +++ b/cmd/frostfs-node/config/engine/config.go @@ -15,6 +15,11 @@ const ( // ShardPoolSizeDefault is a default value of routine pool size per-shard to // process object PUT operations in a storage engine. ShardPoolSizeDefault = 20 + + // InhumePoolSizeDefault is the default size of the engine-level + // worker pool, which is used to process objects during the INHUME + // operation. + InhumePoolSizeDefault = 50 ) // ErrNoShardConfigured is returned when at least 1 shard is required but none are found. @@ -88,3 +93,16 @@ func ShardErrorThreshold(c *config.Config) uint32 { func EngineLowMemoryConsumption(c *config.Config) bool { return config.BoolSafe(c.Sub(subsection), "low_mem") } + +// InhumePoolSize returns the value of "inhume_pool_size" config parameter from +// "storage" section. +// +// Returns InhumePoolSizeDefault if the value is not a positive number. +func InhumePoolSize(c *config.Config) uint32 { + v := config.Uint32Safe(c.Sub(subsection), "inhume_pool_size") + if v > 0 { + return v + } + + return InhumePoolSizeDefault +} diff --git a/cmd/frostfs-node/config/engine/config_test.go b/cmd/frostfs-node/config/engine/config_test.go index 19ad0e7ac..e9b132ca2 100644 --- a/cmd/frostfs-node/config/engine/config_test.go +++ b/cmd/frostfs-node/config/engine/config_test.go @@ -39,6 +39,7 @@ func TestEngineSection(t *testing.T) { require.EqualValues(t, 0, engineconfig.ShardErrorThreshold(empty)) require.EqualValues(t, engineconfig.ShardPoolSizeDefault, engineconfig.ShardPoolSize(empty)) require.EqualValues(t, mode.ReadWrite, shardconfig.From(empty).Mode()) + require.EqualValues(t, engineconfig.InhumePoolSizeDefault, engineconfig.InhumePoolSize(empty)) }) const path = "../../../../config/example/node" @@ -48,6 +49,7 @@ func TestEngineSection(t *testing.T) { require.EqualValues(t, 100, engineconfig.ShardErrorThreshold(c)) require.EqualValues(t, 15, engineconfig.ShardPoolSize(c)) + require.EqualValues(t, 50, engineconfig.InhumePoolSize(c)) err := engineconfig.IterateShards(c, true, func(sc *shardconfig.Config) error { defer func() { diff --git a/config/example/node.yaml b/config/example/node.yaml index 8f9300b4a..d4dc745bb 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -124,6 +124,7 @@ storage: # note: shard configuration can be omitted for relay node (see `node.relay`) shard_pool_size: 15 # size of per-shard worker pools used for PUT operations shard_ro_error_threshold: 100 # amount of errors to occur before shard is made read-only (default: 0, ignore errors) + inhume_pool_size: 50 # size of engine-level worker pool used during INHUME operation shard: default: # section with the default shard parameters