libp2p / go-libp2p-connmgr

a resource sentinel that keeps connection count under reasonable bounds
https://libp2p.io
MIT License
20 stars 17 forks source link

bandwidth rate limit #37

Open yutongp opened 5 years ago

yutongp commented 5 years ago

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

raulk commented 5 years ago

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?

yutongp commented 5 years ago

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.

jacobheun commented 4 years ago

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.