allegro / allegro/bigcache

memory increase problem

Abierto
#286 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
8.2k
Forks
614
Merge medio
5 d 12 h
PR fusionados (30 d)
1

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.