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 #757

Open
rueian opened this issue Feb 13, 2025 · 0 comments
Open

Use timer for background PINGs instead of a long-live goroutine #757

rueian opened this issue Feb 13, 2025 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rueian
Copy link
Collaborator

rueian commented Feb 13, 2025

Currently, we use a long-live goroutine for each connection to do background PINGs:

rueidis/pipe.go

Lines 325 to 327 in 3171947

if p.timeout > 0 && p.pinggap > 0 {
go p.backgroundPing()
}

In the current approach, we create the same amount of background goroutines as the number of connections that wait periodically to send a PING to the connection. I’m curious to know if using time.AfterFunc instead would enhance memory usage and improve the scheduling for other more important goroutines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant