memory increase problem
- Vorherrschende Sprache
- Go
- Sterne
- 8.2k
- Forks
- 614
- Ø Merge
- 5 T. 12 Std.
- Gemergte PRs (30 T.)
- 1
Beschreibung
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.