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