-
Notifications
You must be signed in to change notification settings - Fork 719
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
statistics: multidimensional hot peer cache #2140
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2140 +/- ##
==========================================
- Coverage 75.95% 75.94% -0.01%
==========================================
Files 195 195
Lines 20376 20376
==========================================
- Hits 15477 15475 -2
- Misses 3704 3709 +5
+ Partials 1195 1192 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PTAL @rleungx |
server/statistics/topn_test.go
Outdated
} | ||
} | ||
|
||
func putPerm(c *C, tn *TopN, K, Total int, f func(x int) float64, isUpdate bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
K, Total
should start with the lowercase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed.
server/statistics/topn.go
Outdated
// NOTE: panic if k <= 0 or n <= 0. | ||
func NewTopN(k, n int, ttl time.Duration) *TopN { | ||
if k <= 0 || n <= 0 { | ||
panic("invalid arguments for NewTopN") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about printing the value of n
and k
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
_ = tn.ttlLst.Remove(id) | ||
tn.maintain() | ||
return item | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems no need to return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think return the removed item is a better API. And it is used in the test.
/run-all-tests |
/run-cherry-picker |
cherry pick to release-3.1 in PR #2244 |
What problem does this PR solve?
First step of #2139 . The hot peer cache is not working with multidimensional load.
What is changed and how it works?
Modify the
TopN
to support multidimensional load.Check List
Tests