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.
master
Klaus Post 4 years ago committed by GitHub
parent 84bf4624a4
commit 5ad032826a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cmd/handler-api.go

@ -22,6 +22,7 @@ import (
"time" "time"
"github.com/minio/minio/cmd/config/api" "github.com/minio/minio/cmd/config/api"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/sys" "github.com/minio/minio/pkg/sys"
) )
@ -45,7 +46,9 @@ func (t *apiConfig) init(cfg api.Config, setDriveCount int) {
if cfg.RequestsMax <= 0 { if cfg.RequestsMax <= 0 {
stats, err := sys.GetStats() stats, err := sys.GetStats()
if err != nil { 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 // max requests per node is calculated as
// total_ram / ram_per_request // total_ram / ram_per_request

Loading…
Cancel
Save