-
Notifications
You must be signed in to change notification settings - Fork 928
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
Conversation
37c89c6
to
8d11121
Compare
8d11121
to
f1e8d6a
Compare
// TODO(@Wondertan): PR to bitswap to make this timeout configurable | ||
// Higher timeout increases the probability of successful reconstruction |
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.
I think this todo should not be part of code base. Lets park it into issue instead
// 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 |
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.
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.
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.
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.
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.
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
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.
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)) |
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.
Maybe we should add versioning in case protocol breaking changes?
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.
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.
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.
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
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.
I thought of including that in this PR, but decided against that as those constructors should land next to reconstruction retrieval.
This PR abstracts away Bitswap parameterization and provides simple constructors optimally configured for Shwap protocol composition.