go-libp2p-connmgr icon indicating copy to clipboard operation
go-libp2p-connmgr copied to clipboard

bandwidth rate limit

Open yutongp opened this issue 6 years ago • 3 comments

seems both js: https://github.com/libp2p/js-libp2p-connection-manager and rust: https://github.com/libp2p/rust-libp2p/blob/master/transports/ratelimit/src/lib.rs have the feature to disconnect peers if they send data exceed a threshold. That is very nice feature we would like to use in the go version as well.

Is there anything equivalent in go version to block peers who send large amount of data? If not, could you point out how to measure the bandwidth usage in go version for each peer? So we can write our own implementation of connmgr to achieve this feature. Thanks

yutongp avatar Apr 10 '19 21:04 yutongp

I’m interested in eventually turning the connection manager into a traffic shaper, and @jhiesey is researching mechanisms for proactive resource management in libp2p.

How willing would your team be to work with the community on this?

raulk avatar Apr 11 '19 08:04 raulk

I’m interested in eventually turning the connection manager into a traffic shaper, and @jhiesey is researching mechanisms for proactive resource management in libp2p.

How willing would your team be to work with the community on this?

In short term, due to our timeline, we will have to apply the change on our end. In mid term and long term, since traffic priorities, global and peer rate limiting are what features we need, I think our goals are aligned with yours. It would be nice if our work can benefit the community.

We are still new to libp2p, still on the stage that we are confusing about what modules are used for what. We probably will need some help from you and some time to work on it (other higher priority stuffs may come and go). If you need this component in a tight timeline, we may not be the right group to take on it.

yutongp avatar Apr 13 '19 00:04 yutongp

You could work around this by tracking the bandwidth stats from metrics, https://github.com/libp2p/go-libp2p-core/blob/master/metrics/bandwidth.go, and then performing disconnects of peers who exceed this. I don't believe there is a way to throttle the connection though.

jacobheun avatar Jun 26 '20 17:06 jacobheun