allegro / allegro/bigcache

memory increase problem

Aperta
#286 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
8.2k
Fork
614
Merge medio
5g 12h
PR unite (30g)
1

Descrizione

version: v3.0.0
go version: 1.16

case:
1. config:
```
t := time.Hour
bigcache.Config{
Shards: 1024,
LifeWindow: t + t/10,
MaxEntriesInWindow: 1000 * 10 * 60,
MaxEntrySize: 500,
CleanWindow: t / 2,
Verbose: true,
HardMaxCacheSize: 1024,
OnRemove: nil,
}
```
2. created a timer with time.Hour,every Hour will reload 20w+ mysql row item and set them to bigcache,found that once set bigcache (the key almost the same),the memory usage will increase
3. use a pprof to find why memory increase and got that if the old (k,v) not evicted, there will alloc new memory for the (k,v) if you set it again
4. so i got confused should i use a timer to reload data from original mysql db to update the k,v cache, by set it a timer recycle?why the clean window not work right?(in my head i think when cleaned, all evicted item will be delete and memory will decrease to the level before)

plus: when timer tick arrives,i found that it will go to allocateAdditionalMemory when i set a k,v with old key and new v.
which means entries is increased all the time.

The biggest possibility is the way i use bigcache is not right,so any help will be appreciate

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.