-
Notifications
You must be signed in to change notification settings - Fork 439
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
Optimize load rules for max size rule #176
Optimize load rules for max size rule #176
Conversation
Codecov Report
@@ Coverage Diff @@
## master #176 +/- ##
==========================================
+ Coverage 44.62% 44.75% +0.12%
==========================================
Files 78 78
Lines 4329 4357 +28
==========================================
+ Hits 1932 1950 +18
- Misses 2184 2188 +4
- Partials 213 219 +6
Continue to review full report at Codecov.
|
@sczyh30
But there are still some issues to discuss:
Some of my thinking is to sharding and updating the rule list, but this will bring some issues for reuse statistics. Do you have more suggestion? |
rs := make([]cb.Rule, 0, 1000) | ||
intervals := []uint32{10000, 15000, 20000, 25000, 30000} | ||
for i := 0; i < 1000; i++ { | ||
retryTimeout := intervals[rand.Int()%5] |
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.
rand.Int()
will generate the same pseudo-random sequence if you don't call rand.Seed()
first.
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.
Updated.
825db3e
to
8e52aa3
Compare
core/hotspot/rule_manager.go
Outdated
defer tcMux.Unlock() | ||
defer func() { | ||
tcMux.Unlock() | ||
logger.Infof("Updating hotspot rule spends %d ns.", util.CurrentTimeNano()-start) |
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.
Make it "debug" level?
defer func() { | ||
tcMux.Unlock() | ||
logger.Infof("Updating hotspot rule spends %d ns.", util.CurrentTimeNano()-start) | ||
logRuleUpdate(m) |
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.
Here we may need to handle cases regarding panic outside (where the log is not required).
8e52aa3
to
6e41449
Compare
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
Thanks! |
Describe what this PR does / why we need it
Does this pull request fix one issue?
Describe how you did it
Describe how to verify it
Special notes for reviews