forked from TrueCloudLab/frostfs-http-gw
[#72] Support soft memory limit setting
Signed-off-by: Roman Loginov <r.loginov@yadro.com>
This commit is contained in:
parent
834d5b93e5
commit
40568590c7
6 changed files with 121 additions and 65 deletions
15
settings.go
15
settings.go
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
|
@ -36,6 +37,8 @@ const (
|
|||
|
||||
defaultPoolErrorThreshold uint32 = 100
|
||||
|
||||
defaultSoftMemoryLimit = math.MaxInt64
|
||||
|
||||
cfgServer = "server"
|
||||
cfgTLSEnabled = "tls.enabled"
|
||||
cfgTLSCertFile = "tls.cert_file"
|
||||
|
@ -90,6 +93,9 @@ const (
|
|||
// Zip compression.
|
||||
cfgZipCompression = "zip.compression"
|
||||
|
||||
// Runtime.
|
||||
cfgSoftMemoryLimit = "runtime.soft_memory_limit"
|
||||
|
||||
// Command line args.
|
||||
cmdHelp = "help"
|
||||
cmdVersion = "version"
|
||||
|
@ -516,3 +522,12 @@ func fetchPeers(l *zap.Logger, v *viper.Viper) []pool.NodeParam {
|
|||
|
||||
return nodes
|
||||
}
|
||||
|
||||
func fetchSoftMemoryLimit(cfg *viper.Viper) int64 {
|
||||
softMemoryLimit := cfg.GetSizeInBytes(cfgSoftMemoryLimit)
|
||||
if softMemoryLimit <= 0 {
|
||||
softMemoryLimit = defaultSoftMemoryLimit
|
||||
}
|
||||
|
||||
return int64(softMemoryLimit)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue