Skip to content

Commit

Permalink
Add a reasonable if unable to get total RAM (minio#10506)
Browse files Browse the repository at this point in the history
Though unlikely we shouldn't skip initializing the API if we cannot get RAM.

Add 16GiB as a default and log the error.
  • Loading branch information
klauspost authored Sep 18, 2020
1 parent 84bf462 commit 5ad0328
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/handler-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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
Expand Down

0 comments on commit 5ad0328

Please sign in to comment.