forked from TrueCloudLab/frostfs-node
[#2260] node: Use a separate client cache for PUT service
Currently, under a mixed load one failed PUT can lead to closing connection for all concurrent GETs. For PUT it does no harm: we have many other nodes to choose from. For GET we are limited by `REP N` factor, so in case of failover we can close the connection with the only node posessing an object, which leads to failing the whole operation. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
0b61a3c961
commit
2b755ddb12
2 changed files with 24 additions and 13 deletions
|
@ -344,6 +344,7 @@ type shared struct {
|
||||||
|
|
||||||
clientCache *cache.ClientCache
|
clientCache *cache.ClientCache
|
||||||
bgClientCache *cache.ClientCache
|
bgClientCache *cache.ClientCache
|
||||||
|
putClientCache *cache.ClientCache
|
||||||
localAddr network.AddressGroup
|
localAddr network.AddressGroup
|
||||||
|
|
||||||
key *keys.PrivateKey
|
key *keys.PrivateKey
|
||||||
|
@ -576,6 +577,7 @@ func initCfg(appCfg *config.Config) *cfg {
|
||||||
respSvc: response.NewService(response.WithNetworkState(netState)),
|
respSvc: response.NewService(response.WithNetworkState(netState)),
|
||||||
clientCache: cache.NewSDKClientCache(cacheOpts),
|
clientCache: cache.NewSDKClientCache(cacheOpts),
|
||||||
bgClientCache: cache.NewSDKClientCache(cacheOpts),
|
bgClientCache: cache.NewSDKClientCache(cacheOpts),
|
||||||
|
putClientCache: cache.NewSDKClientCache(cacheOpts),
|
||||||
persistate: persistate,
|
persistate: persistate,
|
||||||
}
|
}
|
||||||
c.cfgAccounting = cfgAccounting{
|
c.cfgAccounting = cfgAccounting{
|
||||||
|
@ -617,6 +619,7 @@ func initCfg(appCfg *config.Config) *cfg {
|
||||||
|
|
||||||
c.onShutdown(c.clientCache.CloseAll) // clean up connections
|
c.onShutdown(c.clientCache.CloseAll) // clean up connections
|
||||||
c.onShutdown(c.bgClientCache.CloseAll) // clean up connections
|
c.onShutdown(c.bgClientCache.CloseAll) // clean up connections
|
||||||
|
c.onShutdown(c.putClientCache.CloseAll) // clean up connections
|
||||||
c.onShutdown(func() { _ = c.persistate.Close() })
|
c.onShutdown(func() { _ = c.persistate.Close() })
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
|
@ -182,6 +182,14 @@ func initObjectService(c *cfg) {
|
||||||
basicConstructor: c.clientCache,
|
basicConstructor: c.clientCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
putConstructor := &coreClientConstructor{
|
||||||
|
log: c.log,
|
||||||
|
nmSrc: c.netMapSource,
|
||||||
|
netState: c.cfgNetmap.state,
|
||||||
|
trustStorage: c.cfgReputation.localTrustStorage,
|
||||||
|
basicConstructor: c.putClientCache,
|
||||||
|
}
|
||||||
|
|
||||||
var irFetcher v2.InnerRingFetcher
|
var irFetcher v2.InnerRingFetcher
|
||||||
|
|
||||||
if c.cfgMorph.client.ProbeNotary() {
|
if c.cfgMorph.client.ProbeNotary() {
|
||||||
|
@ -255,7 +263,7 @@ func initObjectService(c *cfg) {
|
||||||
|
|
||||||
sPut := putsvc.NewService(
|
sPut := putsvc.NewService(
|
||||||
putsvc.WithKeyStorage(keyStorage),
|
putsvc.WithKeyStorage(keyStorage),
|
||||||
putsvc.WithClientConstructor(coreConstructor),
|
putsvc.WithClientConstructor(putConstructor),
|
||||||
putsvc.WithMaxSizeSource(newCachedMaxObjectSizeSource(c)),
|
putsvc.WithMaxSizeSource(newCachedMaxObjectSizeSource(c)),
|
||||||
putsvc.WithObjectStorage(os),
|
putsvc.WithObjectStorage(os),
|
||||||
putsvc.WithContainerSource(c.cfgObject.cnrSource),
|
putsvc.WithContainerSource(c.cfgObject.cnrSource),
|
||||||
|
|
Loading…
Reference in a new issue