Skip to content

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

@rueian

Description

@rueian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions