mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/workingsetcache: do not rotate cache if it is in whole
state
This should reduce the maximum memory usage for the cache in `whole` state
This commit is contained in:
parent
fbac1a9dad
commit
d128a5bf99
1 changed files with 6 additions and 3 deletions
|
@ -172,6 +172,9 @@ func (c *Cache) cacheSizeWatcher() {
|
||||||
return
|
return
|
||||||
case <-t.C:
|
case <-t.C:
|
||||||
}
|
}
|
||||||
|
if c.loadMode() != split {
|
||||||
|
continue
|
||||||
|
}
|
||||||
var cs fastcache.Stats
|
var cs fastcache.Stats
|
||||||
curr := c.curr.Load().(*fastcache.Cache)
|
curr := c.curr.Load().(*fastcache.Cache)
|
||||||
curr.UpdateStats(&cs)
|
curr.UpdateStats(&cs)
|
||||||
|
@ -188,10 +191,10 @@ func (c *Cache) cacheSizeWatcher() {
|
||||||
// Do this in the following steps:
|
// Do this in the following steps:
|
||||||
// 1) switch to mode=switching
|
// 1) switch to mode=switching
|
||||||
// 2) move curr cache to prev
|
// 2) move curr cache to prev
|
||||||
// 3) create curr with the double size
|
// 3) create curr cache with doubled size
|
||||||
// 4) wait until curr size exceeds maxBytesSize, i.e. it is populated with new data
|
// 4) wait until curr cache size exceeds maxBytesSize, i.e. it is populated with new data
|
||||||
// 5) switch to mode=whole
|
// 5) switch to mode=whole
|
||||||
// 6) drop prev
|
// 6) drop prev cache
|
||||||
|
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
c.setMode(switching)
|
c.setMode(switching)
|
||||||
|
|
Loading…
Reference in a new issue