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

protocols/kad/behaviour: Return peers independent of record existence #1544

Merged
merged 1 commit into from
Apr 8, 2020

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented Apr 7, 2020

A node receiving a GetRecord request first checks whether it has the given record. If it does have the record it does not return closer nodes. (See https://github.com/libp2p/rust-libp2p/blob/master/protocols/kad/src/behaviour.rs#L1268-L1287)

A node that knows the record for the given key is likely within a neighborhood of nodes that know the record as well. In addition the node likely knows its neighboorhood well.

When querying for a key with a quorum of 1 the above behavior of only returning the record but not any close peers is fine. Once one queries with a higher quorum having a node respond with the record as well as close nodes is likely going to speed up the query, given that the returned peers probably know the record as well.

This patch aligns the behavior of the GetRecord request with the GetProviderReq behavior.

As far as I can tell the Golang implementation follows the same suggested behavior.

What do you think @romanb

A node receiving a `GetRecord` request first checks whether it has the
given record. If it does have the record it does not return closer
nodes.

A node that knows the record for the given key is likely within a
neighborhood of nodes that know the record as well. In addition the node
likely knows its neighboorhood well.

When querying for a key with a quorum of 1 the above behavior of only
returning the record but not any close peers is fine. Once one queries
with a higher quorum having a node respond with the record as well as
close nodes is likely going to speed up the query, given that the
returned peers probably know the record as well.
Copy link
Contributor

@romanb romanb left a comment

Choose a reason for hiding this comment

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

It does no harm, I suppose, though I did not do it intentionally, since it is not required by regular Kademlia, but I understand your motivation.

@mxinden mxinden merged commit c1191d5 into libp2p:master Apr 8, 2020
mxinden added a commit to mxinden/rust-libp2p that referenced this pull request Apr 8, 2020
…libp2p#1544)

A node receiving a `GetRecord` request first checks whether it has the
given record. If it does have the record it does not return closer
nodes.

A node that knows the record for the given key is likely within a
neighborhood of nodes that know the record as well. In addition the node
likely knows its neighboorhood well.

When querying for a key with a quorum of 1 the above behavior of only
returning the record but not any close peers is fine. Once one queries
with a higher quorum having a node respond with the record as well as
close nodes is likely going to speed up the query, given that the
returned peers probably know the record as well.
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