allegro / allegro/bigcache

memory increase problem

Ouverte
#286 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Go
Étoiles
8.2k
Forks
614
Merge moyen
5 j 12 h
PR mergées (30 j)
1

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.