From 40a4a7faa2984c05bf7fac57ec39d35b2478c781 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 8 Oct 2021 16:34:39 +0300 Subject: [PATCH] [#674] object/put: Use pseudo worker pool for local operations After storage engine started to limit number of PUT operations there is no need to limited worker pool in Object Put service. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 7 +------ cmd/neofs-node/config/object/config.go | 12 ------------ cmd/neofs-node/config/object/config_test.go | 2 -- cmd/neofs-node/object.go | 2 +- config/example/node.env | 1 - config/example/node.json | 3 +-- config/example/node.yaml | 1 - pkg/services/object/put/service.go | 4 ++-- 8 files changed, 5 insertions(+), 27 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 37c418993e..c4adeff2b5 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -193,7 +193,7 @@ type cfgLocalStorage struct { } type cfgObjectRoutines struct { - putRemote, putLocal *ants.Pool + putRemote *ants.Pool } type cfgControlService struct { @@ -441,11 +441,6 @@ func initObjectPool(cfg *config.Config) (pool cfgObjectRoutines) { fatalOnErr(err) } - pool.putLocal, err = ants.NewPool(objectconfig.Put(cfg).PoolSizeLocal(), optNonBlocking) - if err != nil { - fatalOnErr(err) - } - return pool } diff --git a/cmd/neofs-node/config/object/config.go b/cmd/neofs-node/config/object/config.go index 3432f9b85a..465cab7f9f 100644 --- a/cmd/neofs-node/config/object/config.go +++ b/cmd/neofs-node/config/object/config.go @@ -39,15 +39,3 @@ func (g PutConfig) PoolSizeRemote() int { return PutPoolSizeDefault } - -// PoolSizeLocal returns value of "pool_size_local" config parameter. -// -// Returns PutPoolSizeDefault if value is not positive number. -func (g PutConfig) PoolSizeLocal() int { - v := config.Int(g.cfg, "pool_size_local") - if v > 0 { - return int(v) - } - - return PutPoolSizeDefault -} diff --git a/cmd/neofs-node/config/object/config_test.go b/cmd/neofs-node/config/object/config_test.go index 31c85f158c..522040cfce 100644 --- a/cmd/neofs-node/config/object/config_test.go +++ b/cmd/neofs-node/config/object/config_test.go @@ -14,14 +14,12 @@ func TestObjectSection(t *testing.T) { empty := configtest.EmptyConfig() require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeRemote()) - require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeLocal()) }) const path = "../../../../config/example/node" var fileConfigTest = func(c *config.Config) { require.Equal(t, 100, objectconfig.Put(c).PoolSizeRemote()) - require.Equal(t, 101, objectconfig.Put(c).PoolSizeLocal()) } configtest.ForEachFileType(path, fileConfigTest) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index b3f88b64ec..bc1303052b 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -281,7 +281,7 @@ func initObjectService(c *cfg) { objectCore.WithDeleteHandler(objInhumer), ), putsvc.WithNetworkState(c.cfgNetmap.state), - putsvc.WithWorkerPools(c.cfgObject.pool.putRemote, c.cfgObject.pool.putLocal), + putsvc.WithWorkerPools(c.cfgObject.pool.putRemote), putsvc.WithLogger(c.log), ) diff --git a/config/example/node.env b/config/example/node.env index b23c2d6c58..d5ce00b408 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -65,7 +65,6 @@ NEOFS_REPLICATOR_PUT_TIMEOUT=15s # Object service section NEOFS_OBJECT_PUT_POOL_SIZE_REMOTE=100 -NEOFS_OBJECT_PUT_POOL_SIZE_LOCAL=101 # Storage engine section NEOFS_STORAGE_SHARD_POOL_SIZE=15 diff --git a/config/example/node.json b/config/example/node.json index df2288e0ba..cc9cd24ead 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -97,8 +97,7 @@ }, "object": { "put": { - "pool_size_remote": 100, - "pool_size_local": 101 + "pool_size_remote": 100 } }, "storage": { diff --git a/config/example/node.yaml b/config/example/node.yaml index 635f294d88..a6f14e9644 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -85,7 +85,6 @@ replicator: object: put: pool_size_remote: 100 # number of async workers for remote PUT operations - pool_size_local: 101 # number of async workers for local PUT operations storage: shard_pool_size: 15 # size of per-shard worker pools used for PUT operations diff --git a/pkg/services/object/put/service.go b/pkg/services/object/put/service.go index 92c45f3642..e6f72cb2e8 100644 --- a/pkg/services/object/put/service.go +++ b/pkg/services/object/put/service.go @@ -117,9 +117,9 @@ func WithNetworkMapSource(v netmap.Source) Option { } } -func WithWorkerPools(remote, local util.WorkerPool) Option { +func WithWorkerPools(remote util.WorkerPool) Option { return func(c *cfg) { - c.remotePool, c.localPool = remote, local + c.remotePool = remote } }