mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/{storage,mergeset}: clean cached index blocks and inmemory blocks more aggressively
Previously such blocks were cleaned after they weren't accessed during 10 minutes. Now they are cleaned after one minute of missing access. This should reduce memory usage in general case.
This commit is contained in:
parent
e4182dd896
commit
ae91a6883c
2 changed files with 6 additions and 6 deletions
|
@ -231,8 +231,8 @@ func (idxbc *indexBlockCache) cleanByTimeout() {
|
|||
currentTime := fasttime.UnixTimestamp()
|
||||
idxbc.mu.Lock()
|
||||
for k, idxbe := range idxbc.m {
|
||||
// Delete items accessed more than 10 minutes ago.
|
||||
if currentTime-atomic.LoadUint64(&idxbe.lastAccessTime) > 10*60 {
|
||||
// Delete items accessed more than a minute ago.
|
||||
if currentTime-atomic.LoadUint64(&idxbe.lastAccessTime) > 60 {
|
||||
delete(idxbc.m, k)
|
||||
}
|
||||
}
|
||||
|
@ -378,8 +378,8 @@ func (ibc *inmemoryBlockCache) cleanByTimeout() {
|
|||
currentTime := fasttime.UnixTimestamp()
|
||||
ibc.mu.Lock()
|
||||
for k, ibe := range ibc.m {
|
||||
// Delete items accessed more than 10 minutes ago.
|
||||
if currentTime-atomic.LoadUint64(&ibe.lastAccessTime) > 10*60 {
|
||||
// Delete items accessed more than a minute ago.
|
||||
if currentTime-atomic.LoadUint64(&ibe.lastAccessTime) > 60 {
|
||||
delete(ibc.m, k)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,8 +232,8 @@ func (ibc *indexBlockCache) cleanByTimeout() {
|
|||
currentTime := fasttime.UnixTimestamp()
|
||||
ibc.mu.Lock()
|
||||
for k, ibe := range ibc.m {
|
||||
// Delete items accessed more than 10 minutes ago.
|
||||
if currentTime-atomic.LoadUint64(&ibe.lastAccessTime) > 10*60 {
|
||||
// Delete items accessed more than a minute ago.
|
||||
if currentTime-atomic.LoadUint64(&ibe.lastAccessTime) > 60 {
|
||||
delete(ibc.m, k)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue