-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
move the go-libp2p-connmgr here #1297
Conversation
1. Don't ask the system for the time when checking if we should close each connection (potentially thousands of systemcalls!). 2. Log from outside the lock. 3. Log the event around the entire connection closing operation. 4. Preallocate the slice holding the connections to be closed.
It's unused.
faster, cleaner connection closing
Add docs to BasicConnMgr
Improve Test Coverage
Fix concurrency and silence period not being honoured
Users can call Protect() to save a peer from pruning, and Unprotect() to remove the protection. Protected peers don't count towards the target quantity to prune during a connection manager cycle.
Also slightly reworked the loop that selects candidates to prune to make it better behaved. Before, if we needed to prune N connections, we preselected N and ended up doing nothing if they happened to be in the grace period. Now we skip over them and prune ungraced connections until we meet our target.
Add peer protection capability (implementation)
Implement UpsertTag
- fix potential concurrent modification of connection map from concurrent connects/disconnects by locking the segment - don't spawn goroutines on every connect during trims
update go-log to v2
unexport the config
fix race condition in getConnsToClose
add an error return value to the constructor
As trims are triggered by a time.Ticker, this would lead to roughly every second trim being skipped. It also makes calling TrimOpenConns pointless.
remove check for the last trim time when trimming
introduce WithGracePeriod and WithSilencePeriod configuration options
fix flaky tests caused by super short silence periods
aggressively trim connections when we're running out of memory
make emergency trimming optional, disabled by default
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.
do it!
@@ -46,6 +47,7 @@ require ( | |||
github.com/multiformats/go-varint v0.0.6 | |||
github.com/prometheus/common v0.30.0 // indirect | |||
github.com/prometheus/procfs v0.7.3 // indirect | |||
github.com/raulk/go-watchdog v1.2.0 |
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.
that a problem?
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.
It's hidden behind the cgo flag (libp2p/go-libp2p-connmgr#103).
This is easy, as go-libp2p doesn't yet depend on this package yet.
We will initialize a default connection manager in an upcoming PR very soon though.