From d286824d1dc7961084e95dc2aa7b9c95ff48fc89 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 23 Nov 2020 15:09:41 +0300 Subject: [PATCH] [#194] cmd/neofs-node: Use non-blocking worker pools for Object services Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 7456c5175..de1073948 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -421,32 +421,34 @@ func initBucket(prefix string, c *cfg) (bucket bucket.Bucket, err error) { func initObjectPool(cfg *viper.Viper) (pool cfgObjectRoutines) { var err error - pool.get, err = ants.NewPool(cfg.GetInt(cfgObjectGetPoolSize)) + optNonBlocking := ants.WithNonblocking(true) + + pool.get, err = ants.NewPool(cfg.GetInt(cfgObjectGetPoolSize), optNonBlocking) if err != nil { fatalOnErr(err) } - pool.head, err = ants.NewPool(cfg.GetInt(cfgObjectHeadPoolSize)) + pool.head, err = ants.NewPool(cfg.GetInt(cfgObjectHeadPoolSize), optNonBlocking) if err != nil { fatalOnErr(err) } - pool.search, err = ants.NewPool(cfg.GetInt(cfgObjectSearchPoolSize)) + pool.search, err = ants.NewPool(cfg.GetInt(cfgObjectSearchPoolSize), optNonBlocking) if err != nil { fatalOnErr(err) } - pool.put, err = ants.NewPool(cfg.GetInt(cfgObjectPutPoolSize)) + pool.put, err = ants.NewPool(cfg.GetInt(cfgObjectPutPoolSize), optNonBlocking) if err != nil { fatalOnErr(err) } - pool.rng, err = ants.NewPool(cfg.GetInt(cfgObjectRangePoolSize)) + pool.rng, err = ants.NewPool(cfg.GetInt(cfgObjectRangePoolSize), optNonBlocking) if err != nil { fatalOnErr(err) } - pool.rngHash, err = ants.NewPool(cfg.GetInt(cfgObjectRangeHashPoolSize)) + pool.rngHash, err = ants.NewPool(cfg.GetInt(cfgObjectRangeHashPoolSize), optNonBlocking) if err != nil { fatalOnErr(err) }