Uh oh!
There was an error while loading. Please reload this page.
groupcache: add go.mod, update for Go 1.24 - #175
Merged
Conversation
As of Go 1.24 rand.Seed is a no-op. Change TestPeers to use an explicit rand.Rand instead.
dmitshur
approved these changes
Nov 28, 2024
Uh oh!
There was an error while loading. Please reload this page.
mertovun added a commit
to mertovun/groupcache
that referenced
this pull request
Jun 16, 2026
Previously, getFromPeer mirrored a remotely fetched value into the hotCache on a fixed 10% of fetches, chosen at random. This was a placeholder (noted in a TODO) and is a poor signal: it pollutes the hotCache with one-off keys while taking ~10 round trips on average to mirror a genuinely hot key, defeating the purpose of the hotCache. Use the value's owner as the authority on hotness instead. The owner tracks a per-key request rate using an exponentially weighted moving average and reports it in the GetResponse.MinuteQps field (which the wire format already carried but nobody populated). A non-owning peer mirrors a key into its hotCache only once the owner reports a rate at or above hotQPS. The per-key rate state lives inside the mainCache entry, so it is bounded by cache residency and cleaned up by ordinary eviction, with no separate accounting to evict. This replaces the test-only *rand.Rand hook (added in golang#175) with an injectable clock, which TestPeers and the new stats tests use to drive QPS deterministically.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a go.mod file.
As of Go 1.24 rand.Seed is a no-op. Change TestPeers to use an explicit rand.Rand instead.