allegro / allegro/bigcache

Evictions happening all at once

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

Descrizione

I have the following default configuration with an override just for HardMaxCacheSize 30 MB

```go
config := Config{
Shards: 1024,
LifeWindow: eviction,
CleanWindow: 1 * time.Second,
MaxEntriesInWindow: 1000 * 10 * 60,
MaxEntrySize: 500,
StatsEnabled: false,
Verbose: true,
Hasher: newDefaultHasher(),
HardMaxCacheSize: 0,
Logger: DefaultLogger(),
}
config := bigcache.DefaultConfig(10 * time.Minute)
config.HardMaxCacheSize = 30
return bigcache.NewBigCache(config)
```

I have three questions
1) I ran a test script with all additions (no updates and deletes). Been taking stats on number of entries in the cache using the cache.len() function and it shows the entries in the cache is increasing.
After the threshold of memory is crossed, as the additions are increasing, the entries in the cache as returned by len() is zero, instead of being steady at a fixed number.
What am I missing? I tried with diff settings for lifeWindow. In my case I do not want the entires to be evicted unless the cache is full and a new entry is taking its place

2) Is the 30 MB for HardMaxCacheSize pre-alloacated? My understanding is bigCache can add memory at run time so I would expect the cache to grow as the entires grow. But when I see the value of capacity() function, it is always from the beginning staying steady at something ~250 MB. Is this the initial shard size I have been reading about? How can I get it overridden with HardMaxCacheSize.

3) Is LRU impl being planned

Thanks
-Sai

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.