Merged
Conversation
martinmr
suggested changes
Aug 18, 2020
Contributor
martinmr
left a comment
There was a problem hiding this comment.
Reviewed 2 of 2 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @anurags92, @karlmcguire, and @manishrjain)
cache.go, line 326 at r1 (raw file):
c.Metrics.updateLatency(hist) addToHist := func(key uint64) {
Do we want to still do this even if metrics are disabled? We'll be adding to the map but ultimately discarding the data.
cache.go, line 339 at r1 (raw file):
onEvict := func(i *Item) { if ts, has := startTs[i.Key]; has { hist.Update(int64(time.Since(ts) / time.Second))
Add a comment here so it's clearer what the histogram is keeping track of. Like:
// Add the amount of time this item spent in the cache to the histogram.
z/histogram.go, line 83 at r1 (raw file):
} // PrintHistogram prints the histogram data in a human-readable format.
Update docstring.
martinmr
reviewed
Aug 18, 2020
Contributor
martinmr
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r2.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @anurags92, @karlmcguire, @manishrjain, and @martinmr)
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.
If cache is too small, keys can enter and leave very quickly. This results in poor cache usage. Adding a life expectancy histogram to track a sample of keys from admission into cache to eviction. If we see too many keys getting evicted quickly, (along with miss ratio) that's a clear signal that cache size is too small. This would help a user tweak cache size better.
This change is