diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index b0d3c9b6ec0..387808f1c5c 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -84,6 +84,9 @@ const maxMsgSize = 4 << 20 // transport msg limit 4 MiB // for each contract listener. const notificationHandlerPoolSize = 10 +// max GRPC message size. +const defaultBufferSize = 4 * 1024 * 1024 // 4MB + // applicationConfiguration reads and stores component-specific configuration // values. It should not store any application helpers structs (pointers to shared // structs). @@ -545,11 +548,18 @@ func initCfg(appCfg *config.Config) *cfg { ) fatalOnErr(err) + var buffers sync.Pool + buffers.New = func() any { + b := make([]byte, defaultBufferSize) + return &b + } + cacheOpts := cache.ClientCacheOpts{ DialTimeout: apiclientconfig.DialTimeout(appCfg), StreamTimeout: apiclientconfig.StreamTimeout(appCfg), AllowExternal: apiclientconfig.AllowExternal(appCfg), ReconnectTimeout: apiclientconfig.ReconnectTimeout(appCfg), + Buffers: &buffers, } c.shared = shared{ key: key, diff --git a/pkg/network/cache/client.go b/pkg/network/cache/client.go index 1e45670eb76..a6eff5e13f1 100644 --- a/pkg/network/cache/client.go +++ b/pkg/network/cache/client.go @@ -23,6 +23,7 @@ type ( ReconnectTimeout time.Duration ResponseCallback func(client.ResponseMetaInfo) error AllowExternal bool + Buffers *sync.Pool } ) diff --git a/pkg/network/cache/multi.go b/pkg/network/cache/multi.go index 8ad7ce03dea..db3b52b1620 100644 --- a/pkg/network/cache/multi.go +++ b/pkg/network/cache/multi.go @@ -58,6 +58,8 @@ func (x *multiClient) createForAddress(addr network.Address) (clientcore.Client, prmDial client.PrmDial ) + prmInit.SetSignMessageBuffers(x.opts.Buffers) + prmDial.SetServerURI(addr.URIAddr()) if x.opts.DialTimeout > 0 {