[ https://issues.apache.org/jira/browse/DISPATCH-888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16271498#comment-16271498 ]
ASF GitHub Bot commented on DISPATCH-888: ----------------------------------------- GitHub user ganeshmurthy opened a pull request: https://github.com/apache/qpid-dispatch/pull/227 DISPATCH-888 - Modified qdr_forward_balanced_CT() 1. Stop looping as … …soon as we find a link with value of zero. 2. Rotate the links only if there is a link with value of zero You can merge this pull request into a Git repository by running: $ git pull https://github.com/ganeshmurthy/qpid-dispatch DISPATCH-888 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/qpid-dispatch/pull/227.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #227 ---- commit 36937f08fe2d1c011b3b0b6c366270a5bf0c48ec Author: Ganesh Murthy <gmur...@redhat.com> Date: 2017-11-29T20:23:34Z DISPATCH-888 - Modified qdr_forward_balanced_CT() 1. Stop looping as soon as we find a link with value of zero. 2. Rotate the links only if there is a link with value of zero ---- > Balanced distribution algorithm visits each link to determine the > best_eligible_link > ------------------------------------------------------------------------------------ > > Key: DISPATCH-888 > URL: https://issues.apache.org/jira/browse/DISPATCH-888 > Project: Qpid Dispatch > Issue Type: Improvement > Components: Container > Affects Versions: 1.0.0 > Reporter: Ganesh Murthy > Assignee: Ganesh Murthy > Priority: Minor > Fix For: 1.1.0 > > > 1. In forwarder.c the loop that selects the best_eligible_link loops thru all > rlinks as seen below > {noformat} > while (link_ref) { > qdr_link_t *link = link_ref->link; > uint32_t value = DEQ_SIZE(link->undelivered) + > DEQ_SIZE(link->unsettled); > bool eligible = link->capacity > value; > // > // If this is the best eligible link so far, record the fact. > // Otherwise, if this is the best ineligible link, make note of that. > // > if (eligible && eligible_link_value > value) { > best_eligible_link = link; > eligible_link_value = value; > } else if (!eligible && ineligible_link_value > value) { > best_ineligible_link = link; > ineligible_link_value = value; > } > link_ref = DEQ_NEXT(link_ref); > } > {noformat} > Instead the code can exit the loop if the value is 0 (zero). When there are > no outstanding deliveries on a link we can without doubt choose that link as > the best one to send the delivery. > 2. Rotate the rlinks list only if value is zero to avoid frequent list > rotation. In the synchronous case, the code still works. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org