Skip to content

groupcache: add go.mod, update for Go 1.24 - #175

Merged
ianlancetaylor merged 3 commits into
golang:masterfrom
ianlancetaylor:update
Nov 29, 2024
Merged

groupcache: add go.mod, update for Go 1.24#175
ianlancetaylor merged 3 commits into
golang:masterfrom
ianlancetaylor:update

Conversation

@ianlancetaylor

Copy link
Copy Markdown
Contributor

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.

As of Go 1.24 rand.Seed is a no-op. Change TestPeers to use an
explicit rand.Rand instead.
@dmitshur
dmitshur self-requested a review November 28, 2024 22:35
@dmitshurdmitshur removed their assignment Nov 28, 2024

@dmitshurdmitshur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

Comment threadgo.sum Outdated
@ianlancetaylor
ianlancetaylor merged commit 2c02b82 into golang:masterNov 29, 2024
@ianlancetaylor
ianlancetaylor deleted the update branch November 29, 2024 21:07
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.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ianlancetaylor@dmitshur