forked from TrueCloudLab/frostfs-node
[#428] engine: Add low_mem config parameter
Concurrent initialization in case of the metabase resync leads to high memory consumption and potential OOM. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
71a63b8e9c
commit
cac4ed93d6
7 changed files with 44 additions and 10 deletions
|
@ -98,6 +98,7 @@ type applicationConfiguration struct {
|
|||
errorThreshold uint32
|
||||
shardPoolSize uint32
|
||||
shards []shardCfg
|
||||
lowMem bool
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,6 +201,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)
|
||||
|
||||
return engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error { return a.updateShardConfig(c, sc) })
|
||||
}
|
||||
|
@ -675,8 +677,8 @@ func (c *cfg) engineOpts() []engine.Option {
|
|||
opts = append(opts,
|
||||
engine.WithShardPoolSize(c.EngineCfg.shardPoolSize),
|
||||
engine.WithErrorThreshold(c.EngineCfg.errorThreshold),
|
||||
|
||||
engine.WithLogger(c.log),
|
||||
engine.WithLowMemoryConsumption(c.EngineCfg.lowMem),
|
||||
)
|
||||
|
||||
if c.metricsCollector != nil {
|
||||
|
|
|
@ -83,3 +83,8 @@ func ShardPoolSize(c *config.Config) uint32 {
|
|||
func ShardErrorThreshold(c *config.Config) uint32 {
|
||||
return config.Uint32Safe(c.Sub(subsection), "shard_ro_error_threshold")
|
||||
}
|
||||
|
||||
// EngineLowMemoryConsumption returns value of "lowmem" config parmeter from "storage" section.
|
||||
func EngineLowMemoryConsumption(c *config.Config) bool {
|
||||
return config.BoolSafe(c.Sub(subsection), "low_mem")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue