Add slow gc warning log (#21734)

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
This commit is contained in:
Xiaofan 2023-01-18 11:41:43 +08:00 committed by GitHub
parent 0af53d1e2e
commit 3e21d25de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,7 @@ import (
"os" "os"
"runtime" "runtime"
"strconv" "strconv"
"time"
"github.com/milvus-io/milvus/internal/log" "github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/util/hardware" "github.com/milvus-io/milvus/internal/util/hardware"
@ -78,13 +79,26 @@ func optimizeGOGC() {
return mem / 1024 / 1024 return mem / 1024 / 1024
} }
log.Info("GC Tune done", zap.Uint32("previous GOGC", previousGOGC), // currently we assume 20 ms as long gc puase
zap.Uint64("heapuse ", toMB(heapuse)), if (m.PauseNs[(m.NumGC+255)%256] / uint64(time.Millisecond)) < 20 {
zap.Uint64("total memory", toMB(totaluse)), log.Info("GC Tune done", zap.Uint32("previous GOGC", previousGOGC),
zap.Uint64("next GC", toMB(m.NextGC)), zap.Uint64("heapuse ", toMB(heapuse)),
zap.Uint32("new GOGC", newGoGC), zap.Uint64("total memory", toMB(totaluse)),
) zap.Uint64("next GC", toMB(m.NextGC)),
zap.Uint32("new GOGC", newGoGC),
zap.Duration("gc-pause", time.Duration(m.PauseNs[(m.NumGC+255)%256])),
zap.Uint64("gc-pause-end", m.PauseEnd[(m.NumGC+255)%256]),
)
} else {
log.Warn("GC Tune done, and the gc is slow", zap.Uint32("previous GOGC", previousGOGC),
zap.Uint64("heapuse ", toMB(heapuse)),
zap.Uint64("total memory", toMB(totaluse)),
zap.Uint64("next GC", toMB(m.NextGC)),
zap.Uint32("new GOGC", newGoGC),
zap.Duration("gc-pause", time.Duration(m.PauseNs[(m.NumGC+255)%256])),
zap.Uint64("gc-pause-end", m.PauseEnd[(m.NumGC+255)%256]),
)
}
previousGOGC = newGoGC previousGOGC = newGoGC
} }