-
Notifications
You must be signed in to change notification settings - Fork 49
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
A0-4318: rate-limiter for all #1857
base: main
Are you sure you want to change the base?
Conversation
- parametrized by TimeProvider instead of taking `now: Instant` as argument for `rate_limit` - simplified rate_limit method - re-aligned tests of TokenBucket - TokenBucket can be set to rate_per_second = 0 - no data will be read
- seperate RateLimiter implementations for [`tokio::io::AsyncRead`] and [`futures::AsyncRead`] - using [`std::sync::Mutex`] for TokenBucket in RateLimiter - it should allow for `global` rate-limit, not just per connection
… substrate's [`sc_client::network::NetworkWorker`]
- s/alephbft_bit_rate/alephbft_network_bit_rate
…ces `TokenBucket`
…src/network/build/mod.rs`]
… [`finality-aleph/src/network/build/transport.rs`]
…port.rs`] - removed references to [`libp2p`] from [`finality-aleph/src/network/build/mod.rs`]
…d of `requeste` and `available`. It should be also easier now to transform it into wait-free version.
… - so far only tested locally using 7 instances of aleph-node.
…>` in `network/substrate.rs`
…n `finality-aleph/src/network/build/mod.rs`
…ant>>` in TokenBucket
- added ShareTokenBucket, AsyncTokenBucket and ShredBandwidthManager - used for sharing bandwidth between multiple connections
…and Socket-based networks (sync + alephbft) - new default values for rate-limiters (sync + alephbft). 768Kib for alephbft and 5Mib for sync. These values were tested using t3a.xlarge aws instances - nodes were not able to handle more.
…docker/docker_entrypoint.sh to allow configuration of rate-limiting for both sync and alephbft networks
…ated with impls of AsyncRead, etc.
… types in its hierarchy). It is more readable this way - previous version was using `Clone`, which could be confusing regarding if bandwidth was shared or each node uses separate rate.
d12abfd
to
1fbf91b
Compare
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.
Cool stuff, only one readability comment in the end.
), | ||
Dial = impl Send, | ||
ListenerUpgrade = impl Send, | ||
Error = impl Send, |
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.
I don't think there is anything wrong here, but the impl Send
everywhere looks very intimidating. Perhaps a short comment explaining why it's necessary would be nice – I expect something like "We want this to be Send
, but the only way to actually tell the compiler that is to insist that every template argument is Send
.".
Actually, this sounds wrong. What does the compiler say if you only put the last Send
in? Or are these impl
s needed for some other reason, e.g. later usage requiring sending (of _everything?)?
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.
Nice job! But please, make this PR fit the limit of 300 lines.
Description
Implementation of a shared-bandwidth rate-limiter for both substrate-based and alephbft networks.
In a next PR I will introduce a new e2e-test that should help to verify these changes.
Type of change
Checklist: