hub: log LRU registry evictions#634
Merged
Merged
Conversation
The cluster Registry pool is a fixed-size LRU (PoolSize=1024). With the embedded descriptor map now copied per registry (see "hub: stop sharing the embedded descriptor map across registries"), eviction no longer corrupts shared state — an evicted registry simply becomes garbage once goroutines release it. But any work that registry had buffered locally (recent RegisterGVR additions, the current cached preferred map, lastRefreshed) is lost, and operators currently have no way to tell the pool is undersized for the workload. Switch to lru.NewWithEvict and log evictions at V(2). The signal is quiet enough to leave on, loud enough to find when grepped. Signed-off-by: Tamal Saha <tamal@appscode.com>
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 free
to 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.
Summary
Registrypool is a fixed-size LRU (PoolSize=1024). Evictions currently happen silently; an operator has no way to know the pool is undersized for the workload until they notice symptoms (re-discovery storms, lostRegisterGVRstate on subsequent access).RegisterGVRadditions, the current cachedpreferredmap,lastRefreshed) is gone, and that's worth surfacing.lru.NewWithEvictand log atV(2)so the signal is quiet by default, but greppable when investigating "why does this cluster's registry keep cold-starting?"Note on the more invasive options
Test plan
make unit-testsPoolSizeartificially lowered (e.g. 4) and 10+ unique cluster UIDs; verifyevicted cluster registry from poollines appear at-v=2.🤖 Generated with Claude Code