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

Improve piece downloading #3259

Merged
merged 12 commits into from
Nov 26, 2024
Merged

Improve piece downloading #3259

merged 12 commits into from
Nov 26, 2024

Conversation

nazar-pc
Copy link
Member

There is some reafactoring here, but the primary goal is to accelerate PieceProvider.

Previously it had somewhat optimized implementation for downloading from connected peers and non-optimized implementation for closest peers downloads.

This new implementation is actually a bit simpler and unifies both mechanisms under single uniform logic. It does so by querying closest peers to convert them into connected and continue from there.

Together with piece cache tweaks from my testing this helps with both peak and sustained downloading speed. I'll be looking into avoiding making requests to connected peers that are not able to serve pieces and generally to non-farmers, but that will be a separate PR.

Code contributor checklist:

Copy link
Member

@shamil-gadelshin shamil-gadelshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense overall but even after offline discussion it's hard to follow the logic. The comment for the changed function from piece_provider seems to obsolete. Please, try to summarize the current algorithm there.

@nazar-pc
Copy link
Member Author

Cleaned up comment a bit. All crucial sections seem to have a comment describing what they do.

@nazar-pc nazar-pc added this pull request to the merge queue Nov 26, 2024
Merged via the queue into main with commit 49d9638 Nov 26, 2024
8 checks passed
@nazar-pc nazar-pc deleted the improve-piece-downloading branch November 26, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants