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

feat(shwap/bitswap): Shwap optimized Bitswap constructors #3536

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

Wondertan
Copy link
Member

This PR abstracts away Bitswap parameterization and provides simple constructors optimally configured for Shwap protocol composition.

Comment on lines +22 to +23
// TODO(@Wondertan): PR to bitswap to make this timeout configurable
// Higher timeout increases the probability of successful reconstruction
Copy link
Member

Choose a reason for hiding this comment

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

I think this todo should not be part of code base. Lets park it into issue instead

share/shwap/p2p/bitswap/bitswap.go Show resolved Hide resolved
share/shwap/p2p/bitswap/bitswap.go Show resolved Hide resolved
Comment on lines +46 to +51
// maxServerWantListsPerPeer defines the limit for maximum possible cached wants/requests per peer
// in the Bitswap. Exceeding this limit will cause Bitswap server to drop requested wants leaving
// client stuck for sometime.
// Thus, we make the limit a bit generous, so we minimize the chances of this happening.
// This is relevant until https://github.com/ipfs/boxo/pull/629#discussion_r1653362485 is fixed.
maxServerWantListsPerPeer = 8096
Copy link
Member

Choose a reason for hiding this comment

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

Do you think It will affect the max size of blocks we can reconstruct? WIf yes, would be great to specify max eds size we can support with this value in use.

Copy link
Member Author

@Wondertan Wondertan Jul 23, 2024

Choose a reason for hiding this comment

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

If the limit is reached, reconstruction will slow down for N*30 secs, but it should still succeed. The N represents how many times all the samples didn't fit into the want list.

Copy link
Member

Choose a reason for hiding this comment

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

Where 30sec comes from? If the peer sends 16k Iwants to the server, looks like the server will just drop first 8k of requests. which means it might never reply to those iwant requests. For example, 8096 will not fit 128*128 samples, which might be a potential limitation point for that setting value

Copy link
Member Author

@Wondertan Wondertan Jul 24, 2024

Choose a reason for hiding this comment

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

30 seconds comes from WANT resend timeout in Bitswap MessageeQueue. Client side resends the WANTs every 30 secs basically.

if network == "" {
return ""
}
return protocol.ID(fmt.Sprintf("/%s/shwap", network))
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should add versioning in case protocol breaking changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Breaking changes on the ID/Container level would be reflected in CID's codec bump, so we don't have to worry about it here.

Copy link
Member

Choose a reason for hiding this comment

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

Another question I have about protocol ID is the idea we discussed to separate bitswap networks into samples and reconstruction related. Any plans to make constructors aware of network type in this PR? it seems like a PR those changes would fit well

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought of including that in this PR, but decided against that as those constructors should land next to reconstruction retrieval.

@Wondertan Wondertan merged commit 7e6f0a5 into shwap Aug 8, 2024
25 of 28 checks passed
@Wondertan Wondertan deleted the shwap-bitswap-construct branch August 8, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants