Skip to content
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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

SoulPancake
Copy link
Contributor

@@ -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))
Copy link
Contributor Author

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

Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants