use available memory to restrict API calls (#13047)

also choose 90% of the available memory
to calculate maximum API calls.
This commit is contained in:
Harshavardhana
2021-08-24 09:14:46 -07:00
committed by GitHub
parent f1cab828ee
commit 293d261cf9
4 changed files with 37 additions and 12 deletions

View File

@@ -20,6 +20,7 @@ package cmd
import (
"runtime/debug"
"github.com/minio/minio/internal/logger"
"github.com/minio/pkg/sys"
)
@@ -41,6 +42,10 @@ func setMaxResources() (err error) {
return err
}
if maxLimit < 4096 {
logger.Info("WARNING: maximum file descriptor limit %d is too low for production servers. At least 4096 is recommended. Fix with \"ulimit -n 4096\"", maxLimit)
}
if err = sys.SetMaxOpenFileLimit(maxLimit, maxLimit); err != nil {
return err
}