-
Notifications
You must be signed in to change notification settings - Fork 183
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
Use timer for background PINGs instead of a long-live goroutine #760
base: main
Are you sure you want to change the base?
Conversation
@@ -323,7 +323,7 @@ func _newPipe(connFn func() (net.Conn, error), option *ClientOption, r2ps, nobg | |||
p.background() | |||
} | |||
if p.timeout > 0 && p.pinggap > 0 { | |||
go p.backgroundPing() | |||
p.schedulePing(atomic.LoadInt32(&p.recvs)) |
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.
Any idea how we should benchmark this? @rueian
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 don't have a clear idea but I think we can first do a separate simulation of many <-ticker.C
vs many time.AfterFunc
to see if the latter really helps for memory usage and better scheduling on other goroutines. The simulation doesn't need to have rueidis involved.
#757