[QUESTION]: Too high missed rate?
maxim-ge opened this issue · comments
Question.
I have a test:
func TestRistretto_Get(t *testing.T) {
require := require.New(t)
const CacheSize = 10_000
m, err := ristretto.NewCache(&ristretto.Config{
NumCounters: CacheSize / 10, // number of keys to track frequency
MaxCost: CacheSize, // maximum cost of cache
BufferItems: 64, // number of keys per Get buffer.
})
require.NoError(err)
numFound := 0
numMissed := 0
for i := 0; i < CacheSize; i++ {
k := fmt.Sprint(i)
for {
r := m.Set(k, i+1, 1)
m.Wait()
if r {
break
}
}
_, ok := m.Get(k)
if !ok {
numMissed++
} else {
numFound++
}
}
fmt.Println("numOk:", numFound, "numMissed:", numMissed)
require.NotNil(t)
}
It prints numOk: 3494 numMissed: 6506
. Is it ok that so many keys are missed?
This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.