allegro / allegro/bigcache

Evictions happening all at once

Ouverte
#239 2 commentaires 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

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

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.