Skip to content

Commit

Permalink
[dbnode] Raise rlimit to number of file limit by default (#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
robskillington authored Jul 5, 2019
1 parent 6c96619 commit 5738f2b
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/dbnode/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"path"
"runtime"
"runtime/debug"
"strings"
"time"

clusterclient "github.com/m3db/m3/src/cluster/client"
Expand Down Expand Up @@ -92,8 +91,6 @@ const (
maxBgProcessLimitMonitorDuration = 5 * time.Minute
filePathPrefixLockFile = ".lock"
defaultServiceName = "m3dbnode"
raiseProcessLimitsEnvVar = "PROCESS_LIMITS_RAISE"
raiseProcessLimitsEnvVarTrue = "true"
)

// RunOptions provides options for running the server
Expand Down Expand Up @@ -152,19 +149,17 @@ func Run(runOpts RunOptions) {
}
defer logger.Sync()

raiseLimits := strings.TrimSpace(os.Getenv(raiseProcessLimitsEnvVar))
if raiseLimits == raiseProcessLimitsEnvVarTrue {
// Raise fd limits to nr_open system limit
result, err := xos.RaiseProcessNoFileToNROpen()
if err != nil {
logger.Warn("unable to raise rlimit", zap.Error(err))
} else {
logger.Info("raised rlimit no file fds limit",
zap.Bool("required", result.RaisePerformed),
zap.Uint64("sysNROpenValue", result.NROpenValue),
zap.Uint64("noFileMaxValue", result.NoFileMaxValue),
zap.Uint64("noFileCurrValue", result.NoFileCurrValue))
}
// Raise fd limits to nr_open system limit
result, err := xos.RaiseProcessNoFileToNROpen()
if err != nil {
logger.Warn("unable to raise rlimit to no file fds limit",
zap.Error(err))
} else {
logger.Info("raised rlimit no file fds limit",
zap.Bool("required", result.RaisePerformed),
zap.Uint64("sysNROpenValue", result.NROpenValue),
zap.Uint64("noFileMaxValue", result.NoFileMaxValue),
zap.Uint64("noFileCurrValue", result.NoFileCurrValue))
}

// Parse file and directory modes
Expand Down

0 comments on commit 5738f2b

Please sign in to comment.