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

core/message-handler: round robin order sharing #454

Merged
merged 3 commits into from Oct 22, 2019

Conversation

@jalextowle
Copy link
Contributor

jalextowle commented Oct 17, 2019

Description

The GetOrdersToShare function gets a set of orders from the mesh database to share with other peers. The current strategy for selecting orders to share is simply to choose a random segment of the valid orders in the database's snapshot of length max. This strategy works well---albeit imperfectly---when (number of valid orders) is reasonably close to max, but as the number of valid orders climbs, the risk of some orders not being propagated to peers increases.

A simple strategy to mitigate this issue is to use a round robin strategy for selecting orders. This strategy will select orders by starting at the "beginning" of the database's collection of orders and working all the way up to the last orders in the database. Once the top order has been shared, the strategy loops around and starts sharing orders closer to the "beginning" of the order collection again. This strategy has the benefit that it will exhaustively go through a node's orders, so it will necessarily share all of the valid orders.

@jalextowle jalextowle changed the title message-handler: round robin order sharing core/message-handler: round robin order sharing Oct 17, 2019
@jalextowle jalextowle force-pushed the message-handler/round-robin-sharing branch 4 times, most recently from 1c87045 to 8b99f4e Oct 17, 2019
@jalextowle jalextowle marked this pull request as ready for review Oct 17, 2019
@jalextowle jalextowle requested a review from albrow Oct 17, 2019
core/message_handler.go Outdated Show resolved Hide resolved
core/message_handler.go Outdated Show resolved Hide resolved
core/message_handler.go Outdated Show resolved Hide resolved
@jalextowle jalextowle force-pushed the message-handler/round-robin-sharing branch 2 times, most recently from f625f04 to 987b74d Oct 18, 2019
@jalextowle jalextowle requested a review from albrow Oct 18, 2019
@jalextowle jalextowle force-pushed the message-handler/round-robin-sharing branch from 987b74d to ed72041 Oct 18, 2019
@fabioberger fabioberger force-pushed the development branch from 11e0fa4 to cdece2c Oct 18, 2019
@fabioberger fabioberger force-pushed the message-handler/round-robin-sharing branch from ed72041 to c977d4e Oct 18, 2019
@albrow
albrow approved these changes Oct 21, 2019
core/core.go Outdated Show resolved Hide resolved
@jalextowle jalextowle merged commit f77229d into development Oct 22, 2019
1 check passed
1 check passed
ci/circleci: build Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.