Skip to content
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

Bandwidth limiting #2035

Merged
merged 33 commits into from
Jun 11, 2019
Merged

Bandwidth limiting #2035

merged 33 commits into from
Jun 11, 2019

Conversation

argakiig
Copy link
Contributor

@argakiig argakiig commented May 27, 2019

The purpose of this PR is to help ease resource usage by allowing a limit to be set on outbound bandwidth sent through transport::channel::send()
new config option bandwidth_limit with default of 1572864 bytes per sec
setting bandwidth_limit to 0 will leave it unbounded which is the current behavior
add bool not_dropable default false to nano::transport::channel::send allowing calls to channel::send allow for dropping of traffic types if desired
collect rate for at least 50ms, sample into circular buffer trending over 20 samples to ramp up and down rate

Russel Waters added 6 commits May 27, 2019 12:01
update v17 upgrade path
update v17 config tests
test to validate limiter
update nano::transport::channel::send to send if message shouldnt be dropped
otherwise increment drop stat and dont send
@argakiig argakiig added protocol feature documentation This item indicates the need for or supplies updated or expanded documentation labels May 27, 2019
@argakiig argakiig added this to the V19.0 milestone May 27, 2019
@argakiig argakiig self-assigned this May 27, 2019
convert to key before passing to now public detail_to_string
@zhyatt zhyatt changed the title bandwidth limiting Bandwidth limiting May 30, 2019
simplify limiter
add bool not_dropable default false to nano::transport::channel::send allowing calls to channel::send to drop
Russel Waters added 5 commits June 6, 2019 20:33
const limit as not changed after construction
reverse send logic, default true
adjust to exclude messages such as keepalives and bootstrap traffic
simplify bandwidth limiter
@argakiig argakiig merged commit ee665f0 into nanocurrency:master Jun 11, 2019
argakiig pushed a commit that referenced this pull request Jun 11, 2019
* bandwidth_limit in bytes added to config
update v17 upgrade path
update v17 config tests

* bandwidth limiter class
test to validate limiter

* hook to nano::transport::channel
update nano::transport::channel::send to send if message shouldnt be dropped
otherwise increment drop stat and dont send

* initialize array with brace-enclosed initializer

* correctly 1.5Mb

* update tests to account for correct math and full confirm_ack confirm_req blocks
use 1.5 * 1024 * 1024 for bytes to Mb limit

* update config test

* formatting

* update default value in error text

* add logging message and convenience detail_raw_to_string for dropped data type and size
include publish as it is vote traffic

* should always log dropped messages, this could be improved with a logging config option

* stuff under logging;packet logging

* typo and log out limit on node start

* remove duplicate
convert to key before passing to now public detail_to_string

* Readability and simplification

* use static constexpr in function

* unsigned int < 0 always false

* add republish_vote to could_drop

* trend rate over minimum of 1 sec
simplify limiter
add bool not_dropable default false to nano::transport::channel::send allowing calls to channel::send to drop

* update test to validate ramp down to 0 rate again

* merge master

* remove unused variables in tests
const limit as not changed after construction
reverse send logic, default true
adjust to exclude messages such as keepalives and bootstrap traffic

* clean up tests and add multiple limiters
simplify bandwidth limiter

* formatting

* fix merge issues
flip logic on is_dropable

* allow dropping of keep alives

* whitespace

* use send instead of send_buffer a couple more places
@argakiig argakiig deleted the network_limit branch July 3, 2019 03:59
@zhyatt zhyatt removed the documentation This item indicates the need for or supplies updated or expanded documentation label Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants