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

Conversation

@argakiig
Copy link
Collaborator

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

argakiig added some commits May 27, 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

@argakiig argakiig added this to the V19.0 milestone May 27, 2019

@argakiig argakiig self-assigned this May 27, 2019

argakiig added some commits May 27, 2019

update tests to account for correct math and full confirm_ack confirm…
…_req blocks

use 1.5 * 1024 * 1024 for bytes to Mb limit

@argakiig argakiig added the networking label May 27, 2019

@argakiig argakiig added this to RC 4 (TBD) in V19 May 28, 2019

Show resolved Hide resolved nano/lib/stats.cpp Outdated
remove duplicate
convert to key before passing to now public detail_to_string

@zhyatt zhyatt changed the title bandwidth limiting Bandwidth limiting May 30, 2019

@argakiig argakiig force-pushed the argakiig:network_limit branch from 362742a to c207c6e May 31, 2019

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

@argakiig argakiig requested review from SergiySW, cryptocode and wezrule Jun 1, 2019

Show resolved Hide resolved nano/node/transport/transport.cpp
Show resolved Hide resolved nano/core_test/network.cpp Outdated
Show resolved Hide resolved nano/node/transport/transport.hpp Outdated

argakiig added some commits Jun 7, 2019

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

argakiig added some commits Jun 11, 2019

fix merge issues
flip logic on is_dropable

@argakiig argakiig merged commit ee665f0 into nanocurrency:master Jun 11, 2019

1 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

argakiig added a commit that referenced this pull request Jun 11, 2019

Bandwidth limiting (#2035)
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.