-
Notifications
You must be signed in to change notification settings - Fork 33
Kademlia load balancing #28
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||
| --- | ||||||
| SWIP: <to be assigned> | ||||||
| title: Kademlia load balancing | ||||||
| author: lash <dev@holbrook.no> (https://holbrook.no) Álvaro <alvaro@epiclabs.io> | ||||||
| discussions-to: <URL> | ||||||
| status: Draft | ||||||
| type: <Standards Track (Core, Networking, Interface) | Meta | Informational> | ||||||
| category (*only required for Standard Track): <Core | Networking | Interface | ERC> | ||||||
| created: <date created on, in ISO 8601 (yyyy-mm-dd) format> | ||||||
| requires (*optional): <SWIP number(s)> | ||||||
| replaces (*optional): <SWIP number(s)> | ||||||
| --- | ||||||
|
|
||||||
| <!--You can leave these HTML comments in your merged SWIP and delete the visible duplicate text guides, they will not appear and may be helpful to refer to if you edit it again. This is the suggested template for new SWIPs. Note that a SWIP number will be assigned by an editor. When opening a pull request to submit your SWIP, please use an abbreviated title in the filename, `SWIP-draft_title_abbrev.md`. The title should be 44 characters or less.--> | ||||||
| This is the suggested template for new SWIPs. | ||||||
|
|
||||||
| Note that a SWIP number will be assigned by an editor. When opening a pull request to submit your SWIP, please use an abbreviated title in the filename, `SWIP-draft_title_abbrev.md`. | ||||||
|
|
||||||
| The title should be 44 characters or less. | ||||||
|
|
||||||
| ## Simple Summary | ||||||
|
|
||||||
| Initial improvement for evenly distributing requests among peers. | ||||||
|
|
||||||
| ## Motivation | ||||||
|
|
||||||
| Currently no logic exists to guarantee that routing is distributed among peers in a bin. If a bin is unchanged between kademlia queries for forwarding peers in that bin, currently the most likely result is that the same peer will always be returned. This | ||||||
|
|
||||||
| Hence a load balancing mechanism should be introduced. Load balancing is a topic that can be made as complex as desired. However, a simple round-robin scheme distributing requests evenly among the peers is already a vast improvement over the current (lack of) scheme. | ||||||
|
|
||||||
| ## Specification | ||||||
|
|
||||||
| The component should be a layer above the kademlia itself, and most likely sits in the same layer as - or is even perhaps the same component as - the planned convergence of the request and message forwarding engine (todo link to related issue). | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forwarding issue: |
||||||
|
|
||||||
| Let the simplest incarnation be keeping a counter that sorts the peers in the number of request in ascending order. The peer with the lower request count is selected. | ||||||
|
|
||||||
| However, since certain operations only work in conjunction with peers that have certain Capabilities, Capability-filtered peer request counters also need to be kept. | ||||||
|
|
||||||
| In the first version, there is no need to merge the request counts originated in Capability-filters with unfiltered ones. In other words, if a query returns a low number for Capability "pss" even though the peer does not have the lowest request count overall, this peer is still selected in the context of pss. | ||||||
|
|
||||||
| ## Backwards Compatibility | ||||||
|
|
||||||
| The implementation should have no compabitility issues | ||||||
|
|
||||||
| ## Test Cases | ||||||
|
|
||||||
| * Given `m` requests to `n` peers in a bin, after `m*n` requests the peers will have made `m` requests each. | ||||||
| * Given `m` requests to `n` peers within the neighborhood, after `m*n` requests the peers will have made `m` requests each. | ||||||
| * Given `m` requests for no capability and `ma` requests for capability `a` to peers `n` with all capabilities and peers `na` with capability `a`, after `n*n + ma*na` requests the `ma` peers will have made `ma+m` requests each. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. n * n -> m * n I think it should be.
Suggested change
|
||||||
|
|
||||||
| ## Implementation | ||||||
|
|
||||||
| Pending | ||||||
|
|
||||||
| ## Copyright | ||||||
|
|
||||||
| Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). | ||||||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"returned. This
Hence ... "
can you please reword this?