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
WIP: Added latency community #569
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qstokkink
force-pushed
the
add_latency_community
branch
from
September 12, 2019 13:09
c3d9899
to
85250bd
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
qstokkink
force-pushed
the
add_latency_community
branch
from
September 12, 2019 13:42
85250bd
to
c4c62d5
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
qstokkink
force-pushed
the
add_latency_community
branch
from
September 12, 2019 14:10
6468dca
to
4459be6
Compare
This comment has been minimized.
This comment has been minimized.
qstokkink
force-pushed
the
add_latency_community
branch
20 times, most recently
from
September 14, 2019 13:05
e3f24ba
to
bf08971
Compare
I'm going to give up on finishing it today. I cannot get the matching algorithm to behave reliably with differing peer latency distributions. |
qstokkink
force-pushed
the
add_latency_community
branch
13 times, most recently
from
September 16, 2019 14:09
d2894c9
to
7e95329
Compare
This comment has been minimized.
This comment has been minimized.
qstokkink
force-pushed
the
add_latency_community
branch
3 times, most recently
from
September 17, 2019 12:48
81ef690
to
40d3075
Compare
qstokkink
changed the title
WIP: Added latency community
READY: Added latency community
Sep 17, 2019
Ready for review, let me know if the instructions in the O.P. require supplemental info. |
qstokkink
changed the title
READY: Added latency community
WIP: Added latency community
Sep 17, 2019
qstokkink
force-pushed
the
add_latency_community
branch
from
September 17, 2019 13:38
40d3075
to
0c5d5c5
Compare
qstokkink
changed the title
WIP: Added latency community
READY: Added latency community
Sep 17, 2019
Marking this as W.I.P. to fix the matching issues within this PR. |
Probably not a good idea to merge this, closing for now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the (highly experimental) latency community. The latency community is not enabled by default. To work with the latency community:
Network
class (very important) for theLatencyCommunity
.LatencyCommunity
with only theLatencyEdgeWalk
strategy into IPv8.community.accepted_proposals
set.LatencyEdgeWalk
The
LatencyEdgeWalk
strategy will collect a set number of peers from the bootstrap nodes/trackers, 30 by default. Next, the strategy will attempt to get successive network-unique ping-unique (0.05 seconds similarity) peers from each of these 30 edge roots, up until a given edge length (6 by default). As the edges are being grown, the strategy also provides ping measurements if needed.After each step in the discovery process the
LatencyEdgeWalk
strategy will update its registeredoverlay
by setting theoverlay
'spossible_peers
attribute to the current list of peers included in the disconnected graph of edges (theancestry
datastructure).Every so often (by default 30 seconds), the strategy performs a cleanup of all open connections to peers which are not included in the ancestry.
At the end of each cycle we distinguish two types of peers:
total peers
.possible peers
.LatencyCommunity
The
LatencyCommunity
is in charge of the matching of peers. The Community predominantly uses thePeerSelector
to advise any matching with others. The overlay itself periodically (by default every 5 seconds) (a) sends out proposals and keeps a window (30 by default) of optimal matches or (b) breaks the current worst match it has if the amount of matches is equal to the required amount (60 by default). Asynchronously theLatencyCommunity
may decide to accept or reject incoming proposals.The
LatencyCommunity
provides the last class of peers:matched peers
.PeerSelector
This class uses kerning to decide the error of including a peer into a given existing set of choices, according to a specified target distribution. The idea is that a programmer gives both (1) a continuous function (
lambda x: preferred_count / x
by default) and (2) a list of x-coordinates (bins) to evaluate the function (0.001
through2.001
with steps of0.05
by default). This function need to be scaled precisely for the kerning, this is handled automatically bygenerate_reference
for a given preferred peer count and the current binning distribution. We use Gaussian kernel density estimation.Gumby & Jenkins
My personal Jenkins experiment for this PR can be found here: https://jenkins-ci.tribler.org/job/pers/job/latency_noodle_qstokkink/. The source code for the experiment can be found here: https://github.com/qstokkink/gumby/tree/latency_overlay/experiments/latency_overlay.
Future work
Even though the basic concept works, the CPU utilization should be improved and the matching algorithm will require some further love.