智能调节清理缓存阈值

This commit is contained in:
GoEdgeLab
2023-09-17 12:05:06 +08:00
parent b043388493
commit ea93e911d9

View File

@@ -1004,9 +1004,12 @@ func (this *FileStorage) purgeLoop() {
if lfuFreePercent <= 0 { if lfuFreePercent <= 0 {
lfuFreePercent = 5 lfuFreePercent = 5
// TB级别 // 2TB级别以上
if capacityBytes>>30 > 1000 { if capacityBytes>>30 > 2000 {
lfuFreePercent = 3 lfuFreePercent = 100 /** GB **/ / float32(capacityBytes>>30) * 100 /** % **/
if lfuFreePercent > 3 {
lfuFreePercent = 3
}
} }
} }
@@ -1246,8 +1249,9 @@ func (this *FileStorage) hotLoop() {
func (this *FileStorage) diskCapacityBytes() int64 { func (this *FileStorage) diskCapacityBytes() int64 {
var c1 = this.policy.CapacityBytes() var c1 = this.policy.CapacityBytes()
if SharedManager.MaxDiskCapacity != nil { var nodeCapacity = SharedManager.MaxDiskCapacity // copy
var c2 = SharedManager.MaxDiskCapacity.Bytes() if nodeCapacity != nil {
var c2 = nodeCapacity.Bytes()
if c2 > 0 { if c2 > 0 {
return c2 return c2
} }