Add a reasonable if unable to get total RAM (#10506)

Though unlikely we shouldn't skip initializing the API if we cannot get RAM.

Add 16GiB as a default and log the error.
This commit is contained in:
Klaus Post 2020-09-18 02:03:02 -07:00 committed by GitHub
parent 84bf4624a4
commit 5ad032826a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ import (
"time"
"github.com/minio/minio/cmd/config/api"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/sys"
)
@ -45,7 +46,9 @@ func (t *apiConfig) init(cfg api.Config, setDriveCount int) {
if cfg.RequestsMax <= 0 {
stats, err := sys.GetStats()
if err != nil {
return
logger.LogIf(GlobalContext, err)
// Default to 16 GiB, not critical.
stats.TotalRAM = 16 << 30
}
// max requests per node is calculated as
// total_ram / ram_per_request