Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION]: Too high missed rate? #346

Closed
maxim-ge opened this issue Aug 15, 2023 · 1 comment
Closed

[QUESTION]: Too high missed rate? #346

maxim-ge opened this issue Aug 15, 2023 · 1 comment
Labels
kind/question Something requiring a response. Stale

Comments

@maxim-ge
Copy link

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?

@maxim-ge maxim-ge added the kind/question Something requiring a response. label Aug 15, 2023
Copy link

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.

@github-actions github-actions bot added the Stale label Jul 14, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Something requiring a response. Stale
Development

No branches or pull requests

1 participant