libp2p / notes

libp2p Collaborative Notebook for Research
MIT License
37 stars 4 forks source link

Koorde - beyond Kademlia #20

Open Kubuxu opened 5 years ago

Kubuxu commented 5 years ago

Koorde is a DHT based on Chord, and the driving principle is a bit different than Kademlia. Instead of using XOR metric Chord (and Koorde) interprets keyspace as a circle.

Connecting nodes to the next node in the circle (successor) create the basis of the network. As long as there exists this connection forward, the DHT is fully functional (albeit slow). By maintaining additional connections across the circle, Koorde achieves logarithmic lookup we expect from the DHT.

This is where Koorde and Chord diverge and where the improvement of Koorde comes in. The important benefit of Koorde is its ability to use multiple connections across the network efficiently.

By using (for example) 16 connections, instead of 2, Koorde can reduce the number of required messages (and new connections) by a factor of more than 4 (from 26 to 6.3 on average).

It is important to point out significant differences of Koorde from Kademlia:


In my opinion, and in comparison with Kademlia, Koorde can function as a highly cooperative network but can resist possible failures and attacks. While it might not be a perfect fit for organized chaos type network (what we do currently with our Kademlia), I firmly believe that it can function extremely well in case of delegated routing schemes with dedicated routing network with multiple independent parties cooperating.

With metrics as low as 5.6 messages per lookup I think sub-1 second record lookup time should be possible which would be a major improvement over our current DHT.


I have created a toy implementation of Koorde in Go (https://github.com/Kubuxu/go-toy-koorde-dht). It currently implements the lookup algorithm, but I plan to implement the rest of the protocol there to scope out possible issues. It also provides a way to benchmark the implementation and parameters. These are the results: https://docs.google.com/spreadsheets/d/1PgkvrYWYynu-lS-B8kjjGCuqJqol4nqnleNJzV8brcE/edit?usp=sharing


Koorde paper: https://www.comp.nus.edu.sg/~bleong/hydra/related/kaashoek03koorde.pdf Chord paper: https://pdos.csail.mit.edu/papers/chord:sigcomm01/chord_sigcomm.pdf

dirkmc commented 5 years ago

Could you please explain a little more what you mean when you say Koorde can use 16 connections instead of 2.. are these connections to direct successor nodes in the ring, or are they connections across the ring to node n + 2^(k - 1)? Where does the number 2 come from?

Also when you say connection, do you mean a connection that is kept open (eg TCP) or do you mean that the address of a peer at that ring position is stored locally, and an RCP to it can be made (eg using UDP)

Kubuxu commented 5 years ago

Normal so-called degree-2 Koorde maintains a connection with a successor node and node that is before id 2*m where m is our ID (forwarding connection).

degree-N core maintains N forwarding connections. The nodes are N*m plus N-1 successive nodes.

Essentially successor nodes are used for correction of requests (linear progress), and forwarding connections are used to make exponential progress (in keyspace), but we might have to correct them (make linear progress for some time) if we jumped to close. One of the points of Koorde is showing that the linear progress will have an upper, constant limit.

Also when you say connection, do you mean a connection that is kept open (eg TCP) or do you mean that the address of a peer at that ring position is stored locally, and an RCP to it can be made (eg using UDP)

TCP vs UDP is an implementation detail, but when I say connection, I mean that we have to track those nodes closely. In the case of successor connections, we have to check if they didn't fail to maintain the stability of the network. We will also receive join requests to the network through them. They might want to hand over a key-value store to go offline etc.

In case of forwarding connections (across the circle) we will use them for every request (with equal probability), and the same story, we want to maintain them to tell when they fail so we can recover.

If something is unclear, ask.

dirkmc commented 5 years ago

That's clear, thank you 👍

Stebalien commented 5 years ago

cc @jhiesey @anacrolix

aschmahmann commented 5 years ago

Having more libp2p implementations of routing systems and DHTs for us to work with certainly seems like a 👍.

As was mentioned, Koorde, Kademlia, etc. have different benefits and use cases, so it could be really interesting to see if we can use the testbed to exercise performance under varying types of normal and adversarial conditions.

zot commented 4 years ago

We used to use Pastry in 2008, an early ring-based p2p system, and we had a great experience with it (except that it wasn't very good with NAT).

It's great to see an alternative DHT, a diversity of implementations will make libp2p stronger!