Skip to content

Commit

Permalink
statistics: stats cache set default quota as 20% (pingcap#58013)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Jan 9, 2025
1 parent fedc98a commit 9d0fb30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/statistics/handle/cache/internal/lfu/lfu_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ func NewLFU(totalMemCost int64) (*LFU, error) {
}

// adjustMemCost adjusts the memory cost according to the total memory cost.
// When the total memory cost is 0, the memory cost is set to half of the total memory.
// When the total memory cost is 0, the memory cost is set to 20% of the total memory.
func adjustMemCost(totalMemCost int64) (result int64, err error) {
if totalMemCost == 0 {
memTotal, err := memory.MemTotal()
if err != nil {
return 0, err
}
return int64(memTotal / 2), nil
return int64(memTotal * 20 / 100), nil
}
return totalMemCost, nil
}
Expand Down

0 comments on commit 9d0fb30

Please sign in to comment.