[#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:
Dmitrii Stepanov 2023-06-22 10:46:56 +03:00 committed by Evgenii Stratonikov
parent 71a63b8e9c
commit cac4ed93d6
7 changed files with 44 additions and 10 deletions

View file

@ -210,6 +210,8 @@ type cfg struct {
metrics MetricRegister
shardPoolSize uint32
lowMem bool
}
func defaultCfg() *cfg {
@ -265,3 +267,10 @@ func WithErrorThreshold(sz uint32) Option {
c.errorsThreshold = sz
}
}
// WithLowMemoryConsumption returns an option to set the flag to reduce memory consumption by reducing performance.
func WithLowMemoryConsumption(lowMemCons bool) Option {
return func(c *cfg) {
c.lowMem = lowMemCons
}
}