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

Merged

Conversation

clemahieu
Copy link
Contributor

@clemahieu clemahieu commented Apr 4, 2023

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.

@clemahieu clemahieu added this to the V25.0 milestone Apr 4, 2023
@clemahieu clemahieu requested a review from thsfs April 4, 2023 15:28
… 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.
@clemahieu clemahieu force-pushed the bootstrap_ascending_throttling branch from 563e40b to a1a0a9f Compare April 4, 2023 15:37
@clemahieu clemahieu merged commit fc89500 into nanocurrency:develop Apr 4, 2023
@@ -678,12 +717,23 @@ bool nano::bootstrap_ascending::run_one ()
return success;
}

void nano::bootstrap_ascending::throttle_if_needed ()
{
if (!iterator.warmup () && throttle.throttled ())
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants