-
Notifications
You must be signed in to change notification settings - Fork 114
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
Sync refactoring to improve performance #1000
Conversation
// delay sending the request if we have multiple peers and the last sent message was to | ||
// the current peer by placing the request in the pendingRequests that will be processed | ||
// during the next iteration | ||
if (mgr.getActiveNodes().size() > 1 && node.getIdHash() == lastNode.getIdHash()) { |
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.
not a big concern, the size check can just use " ! isEmpty()"
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.
Actually, here the difference is between 1 or larger. If only 1 peer exists, we will not enforce the requirement of not sending another request to the same peer.
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.
ah, okay.
c38ce32
to
77d9322
Compare
This reverts commit 52eaefe.
77d9322
to
4c4794d
Compare
- algorithm to avoid sending consecutive requests to the same peer when having multiple peers; - merged TaskWrite into TaskSend.
- Removed the storage of status blocks since it was heavy and only marginally useful.
- unifies state tracking for making header requests; - managing received responses; - initial unit tests.
- simplified import block functionality; - removed sync-related constants from p2p module.
Description
Rewrote the sync algorithm to use a header request manager that keeps track of peer states and received headers. Simplifies sync state management and improves performance.
Type of change
Insert x into the following checkboxes to confirm (eg. [x]):