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

Active elections loop tuning #2306

Conversation

guilhermelawless
Copy link
Contributor

@guilhermelawless guilhermelawless commented Sep 18, 2019

Closes #2137 , closes #2139 (alternative to both)

Todo

Documentation

  • active_difficulty updates are now done every ~500ms (give or take), and not 16-36 seconds

PR Description
This PR has 2 main changes:

  • Disables per-block confirm_req in the block processor
  • Changes the confirmation loop such that it has a period of 0.5s instead of 16-36 seconds.

Other things had to be tuned consequently, such as frontier prioritization timings. Data collected on the beta network shows there are large improvements to bandwidth usage under high load, much more agile PoW prioritization, and reduced tcp write drops.

The optimized bandwidth allows for doing a larger number of batch confirm_req directly to representatives in the same amount of time. The PoW prioritization being more agile means even under saturation the network should correctly prioritize blocks with the highest PoW such that those are confirmed fastest.

The active elections container is reduced to 10k soft maximum. As blocks arrive that would immediately be dropped due to a low work difficulty, the election is allowed to live for up to 10 seconds, after which it is dropped.

There is a minimum time of 1 second until an election is considered for confirm_req, and the same time for being consider for active difficulty.

Future improvements

  • Using a passive elections container to store a larger amount of elections that would otherwise be dropped. If the size of a passive election is small and not many operations are performed on the container, it can possibly be in the order of 100k in memory.

  • Consider not rebroadcasting votes if the node is saturating, at least for blocks that would go into passive elections. This means all blocks would be confirmed via confirm_req. A better alternative would be Vote stapling #1006 . Currently, even under saturation, there's a chance that blocks are confirmed via live elections even if they have a low PoW difficulty.

Acknowledgments
Thanks to @Srayman for the enormous help in tuning and testing, and @Joohansson for the blocks.

@guilhermelawless guilhermelawless added performance Performance/resource utilization improvement networking beta testing wanted labels Sep 18, 2019
@guilhermelawless guilhermelawless added this to the V20.0 milestone Sep 18, 2019
@guilhermelawless guilhermelawless self-assigned this Sep 18, 2019
@guilhermelawless guilhermelawless force-pushed the network/limit-single-confirm-req branch 2 times, most recently from 67a7aad to 686a097 Compare September 19, 2019 10:15
Srayman pushed a commit to Srayman/nano-node that referenced this pull request Oct 2, 2019
@zhyatt zhyatt requested review from SergiySW and cryptocode October 9, 2019 16:44
@guilhermelawless guilhermelawless added documentation This item indicates the need for or supplies updated or expanded documentation and removed beta testing wanted labels Oct 9, 2019
@guilhermelawless guilhermelawless force-pushed the network/limit-single-confirm-req branch from 9414f34 to 9d1e2c4 Compare October 9, 2019 17:35
@guilhermelawless guilhermelawless force-pushed the network/limit-single-confirm-req branch from 9d1e2c4 to f0a9ace Compare October 9, 2019 17:44
@guilhermelawless guilhermelawless merged commit ab50aff into nanocurrency:master Oct 11, 2019
@guilhermelawless guilhermelawless deleted the network/limit-single-confirm-req branch October 11, 2019 16:18
@zhyatt zhyatt added the major This item indicates the need for or supplies a major or notable change label Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This item indicates the need for or supplies updated or expanded documentation major This item indicates the need for or supplies a major or notable change networking performance Performance/resource utilization improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants