mirror of https://github.com/milvus-io/milvus.git
Fix GC Tuner when memory is too large (#20353)
Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com> Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>pull/20370/head
parent
a4b3a53123
commit
3f67fad59a
|
@ -60,11 +60,16 @@ func optimizeGOGC() {
|
|||
totaluse := hardware.GetUsedMemoryCount()
|
||||
heapTarget := memoryThreshold - (totaluse - heapuse)
|
||||
|
||||
newGoGC := uint32(math.Floor(float64(heapTarget-heapuse) / float64(heapuse) * 100))
|
||||
if newGoGC < minGOGC {
|
||||
var newGoGC uint32
|
||||
if heapTarget < heapuse {
|
||||
newGoGC = minGOGC
|
||||
} else if newGoGC > maxGOGC {
|
||||
newGoGC = maxGOGC
|
||||
} else {
|
||||
newGoGC = uint32(math.Floor(float64(heapTarget-heapuse) / float64(heapuse) * 100))
|
||||
if newGoGC < minGOGC {
|
||||
newGoGC = minGOGC
|
||||
} else if newGoGC > maxGOGC {
|
||||
newGoGC = maxGOGC
|
||||
}
|
||||
}
|
||||
|
||||
action(newGoGC)
|
||||
|
|
Loading…
Reference in New Issue