dragonflyoss / Dragonfly

This repository has be archived and moved to the new repository https://github.com/dragonflyoss/Dragonfly2.
https://d7y.io
Apache License 2.0
6k stars 773 forks source link

[Help wanted] Dragonfly decentralization #1022

Open yeya24 opened 5 years ago

yeya24 commented 5 years ago

Background

This issue is used to define tasks and track the progress of Dragonfly decentralization feature. For a more specific architecture or design proposal, please check https://github.com/dragonflyoss/Dragonfly/pull/594.

Tasks

Details

dfdaemon and dfget related

Extract dfget as a library

Currently dfdaemon calls dfget by exec.Command. We hope dfdaemon can call dfget through a library instead of calling cmd. We recommend to implement this by adding a new downloader interface. For dfget server, it is OK for it to also remain a single process.

Scheduling strategy in dfget server

In a pure and ideal p2p environment, there is no supernode anymore. Scheduling strategy should be implemented in dfget servers. We can use a flag to start dfget server in p2p mode. For a simplest version, we can implement random scheduling first.

Disks gc in dfget server

Same as the previous one. In each peer, we must gc local disk if the size exceeds one threshold.

Metrics for dfdaemon and dfget server

Add more metrics to dfdaemon and dfget server to indicate the p2p cluster status.

API

Design and implemented the Tracker API

See https://github.com/dragonflyoss/Dragonfly/pull/594. Tracker API is the middle layer between supernode and p2p mode.

Supernod API v2

P2P

Integrating with Serf

We will use Serf to implement gossip in each node.

Peer discovery mechanism

In order to join one current gossip cluster, we need a peer discovery mechanism. We can add a dummy mode to dfdaemon and in this mode, dfdaemon just becomes the initial node(seed) for the gossip cluster. Then every other peer tries to connect to it (we can use DNS here) and join the cluster.

Design and implemented the gossip events

fengzixu commented 5 years ago

On the 26th, we discussed this big feature through the Zoom meeting. Anyone who is interested in it can read the doc as below:

https://docs.google.com/document/d/1cpNpaYEax1qqI6udFLG2wxyjv4YBSb8qa8CcAvGUnhY/edit#

And the meeting video record link: https://youtu.be/s8-NdX77jOc

Any suggestions and comments are welcome.

SataQiu commented 5 years ago

/cc

jyizheng commented 5 years ago

This is super interesting. I am very happy to help.

jyizheng commented 5 years ago

The youtube link is not working.