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

first pass at provide many mechanism #2011

Closed
wants to merge 589 commits into from
Closed

Conversation

whyrusleeping
Copy link
Member

Provide multiple keys at a time, more efficient as we combine RPCs where possible, savings also made during the initial 'find closest peers' step.

The basic tests i added show a savings of over 90% total network bandwidth (100k on new code, 1.5MB old code). It also takes about half the time (though the tests are performed over the loopback, so no latency is involved)

License: MIT
Signed-off-by: Jeromy jeromyj@gmail.com

@jbenet jbenet added the status/in-progress In progress label Nov 27, 2015
@whyrusleeping
Copy link
Member Author

The new code also does a lot better job of distributing providers, i couldnt get the same test i wrote for my new code to pass using the old code, so i had to change the Fatals to Logs

@@ -48,4 +48,7 @@ type Routing interface {

// Provide provides the key to the network
Provide(context.Context, key.Key) error

// Provide multiple keys to the network at the same time, sharing RPCs
ProvideMany(context.Context, []key.Key) error
Copy link
Member

Choose a reason for hiding this comment

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

wonder if that should be a key channel, to allow providing from a single dag in one call, and then do the stack thing this way

@jbenet
Copy link
Member

jbenet commented Dec 1, 2015

reminder: kademlia is an algorithm designed and proved to scale to very large numbers with logarithmic complexity, and it is designed around the concept of an iterative (and concurrent) query that gets closer to a distance target. this changeset goes against that.

think about it like this: it is critical to consider a lot of peers every time (routing tables will get large, hundreds of peers) and pick only the best towards the goal based on the most current information (priority queue), which will come as a result as the query's messages return peers.[0]


the large constant factor problems we see now in our small networks are much more due to our own problems in:

  • the large number of provides
  • very large key-space
  • very slow dials/handshakes
  • not using udp-based transports yet
  • not coalescing messages while we can (i.e. while the dial hasnt completed and an additional message is getting queued for a peer it can be coalesced)

important in this kind of algorithmic change to reason through why your approach here is giving you such better numbers, plot out what nodes are getting requested instead, and come up with an algorithmic argument as to why the model still holds (i strongly suspect it does not).

@jbenet
Copy link
Member

jbenet commented Dec 1, 2015

[0]in fact, one thing to try that may get the same or even better speed up is:

  • to do the message coalescing, and then
  • to coalesce keys into closeness clusters (picking num_clusters > num_kbuckets)
  • to coalesce the priority-sorting function of the queues themselves -- i.e. instead of using a priority queue per query seeded with closest peers and only using the peers found through that query, instead use:
    • a set to keep track of peers queried in this given query (avoid double querying)
    • keep stats (low, high, avg, n) on distances queried (avoid querying "bad peers" altogether)
    • add new found peers to routing table, and then re-sample from the entire routing table each time. (leverage concurrent queries finding better peers) --- this last one may not work that well with very small kbucket sizes + the preference for long-lived nodes. the case where this can break down is the "most distant to peer-id" kbucket, which will cover the largest id space, but still only have a regular number of nodes-- in this case may be worth considering "recently found" peers as part of routing table for the duration of their query)

next, ok := pmreq.getNextTarget()
if ok {
result.closerPeers = []peer.PeerInfo{{ID: next}}
}
Copy link
Member

Choose a reason for hiding this comment

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

this is breaking assumptions as to how the query runner is meant to work. this should be returning a set of closer peers found through this one peer, not the next best through everyone. instead, the entire query runner should be sampling from everyone found -- see #2011 (comment)

@ghost ghost added topic/dht Topic dht topic/perf Performance labels Dec 22, 2015
@whyrusleeping whyrusleeping force-pushed the dev0.4.0 branch 2 times, most recently from 68b9745 to b0a8591 Compare December 28, 2015 14:36
@whyrusleeping whyrusleeping self-assigned this Jan 29, 2016
atomgardner and others added 16 commits March 2, 2016 08:08

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
License: MIT
Signed-off-by: Thomas Gardner <tmg@fastmail.com>

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
assert that you must build from inside your gopath

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
My bad. Introduced in #2366

License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Fix spelling error

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
introduce a low memory flag

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
License: MIT
Signed-off-by: Adrian Ulrich <adrian@blinkenlights.ch>

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT
Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
use net/url to escape paths in web-ui
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
dns: update dns command docs
added --json to "ipfs config" command;
added modification to fuse.conf;

License: MIT
Signed-off-by: Giuseppe Bertone <bertone.giuseppe@gmail.com>
whyrusleeping and others added 27 commits May 5, 2016 10:10
Implements repository initialization with default config
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
This uses a stringList to output each log command as an item in an array in an object called Strings, instead of using the MessageOutput func.

This closes #2636.

License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
startup_cluster() already contains some test_expect_success, so
it should not be inside one.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
test-lib: make checking for docker silent
The link to the commit file shell link should be to the raw file. That makes it easier for peopel to wget it without caring about using GitHubs interface. Perhaps this should also be hosted on IPFS

License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
add a dist_get script for getting bins from dist.ipfs.io
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@Kubuxu Kubuxu closed this May 13, 2016
@Kubuxu Kubuxu deleted the feat/provide-many branch February 27, 2017 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/in-progress In progress topic/dht Topic dht topic/perf Performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet