-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add throttling functionality to the ascending bootstrapper #4205
Add throttling functionality to the ascending bootstrapper #4205
Conversation
… successful retrieval of blocks from other nodes. If there are no recent block retrievals, the bootstrapper will throttle itself and delay between requests. Bootstrapper will make one full pass of the ledger before throttling for quicker syncing on startup.
Disabled node.aggressive_flooding test
563e40b
to
a1a0a9f
Compare
@@ -678,12 +717,23 @@ bool nano::bootstrap_ascending::run_one () | |||
return success; | |||
} | |||
|
|||
void nano::bootstrap_ascending::throttle_if_needed () | |||
{ | |||
if (!iterator.warmup () && throttle.throttled ()) |
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.
Doesn't 'throttle' object access need a lock?
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.
As it's written it assumes synchronisation is handled externally.
This seemed appropriate since it's a 1-to-1 association between bootstrap_ascending instance and throttle instance.
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.
Why then are you locking accesses of this class in other places, I believe your explanation is not correct and it is in fact being used from multiple threads.
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.
In other words, just move the lock acquired on line 725 above this if statement.
This adds the ability for the ascending bootstrapper to slow itself down when no progress is being made. This inability to slow down had a side effect of impacting our unit testing and required us to turn the request rate very low compared to synthetic and beta tests.
With the exception of the aggressive_flooding test, unit tests will now pass when the rate is up to 1024 from 128 having tested with 4096 previously.
This disables the aggressive_flooding test, which will be moved to load tests, since its resource requirement is high.