allegro / allegro/bigcache

memory increase problem

Đang mở
#286 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
8.2k
Fork
614
Merge trung bình
5 ngày 12 giờ
Pull request đã merge (30 ngày)
1

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.