mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 18:10:26 +08:00
优化缓存命中率统计采样时长和数量
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const countSamples = 10_000
|
||||
const countSamples = 100_000
|
||||
|
||||
type Item struct {
|
||||
countHits uint64
|
||||
@@ -138,7 +138,7 @@ func (this *Stat) IsGood(category string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if item.countCached > countSamples {
|
||||
if item.countCached > countSamples && item.timestamp < fasttime.Now().Unix()-600 /** 10 minutes ago **/ {
|
||||
var isGood = item.countHits*100/item.countCached >= this.goodRatio
|
||||
if isGood {
|
||||
item.isGood = true
|
||||
|
||||
Reference in New Issue
Block a user