You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "FancyJan (via GitHub)" <gi...@apache.org> on 2023/10/26 13:18:15 UTC

[I] lalb在有可用节点的情况下仍可能触发“[E112]Fail to select server...” (brpc)

FancyJan opened a new issue, #2427:
URL: https://github.com/apache/brpc/issues/2427

   **Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)**
   lalb在SelectServer的循环中,如果选到不可用的节点,在一定条件下会继续尝试节点树的右子树:
   [https://github.com/apache/brpc/blob/master/src/brpc/policy/locality_aware_load_balancer.cpp#L334](url)
   
   例如某一时刻节点树只有两个节点,0号不可用1号可用。
   按照现在的逻辑如果第一次选中了0,那么这次选择会失败,因为0没有可用的右子树,但是节点树里确实有可用的1号节点。如果连续两次(n=2)一开始选到0,那这一次lb会失败。
   
   在有节点探活失败的情况下可能发生,虽然概率不大,但运气不好每次都选中不可用节点的概率确实存在,尤其是在下游节点不多的情况下。
   
   **Describe the solution you'd like (描述你期望的解决方法)**
   在单次Select循环中,如果节点不可用即[https://github.com/apache/brpc/blob/master/src/brpc/policy/locality_aware_load_balancer.cpp#L334](url)为false,
   那么尝试进入左子树作为兜底,例如:
   `else {
                   dice = butil::fast_rand_less_than(left);
                   index = index * 2 + 1;
                   if (index < n) {
                       continue;
                   }
    }`
   
   **Describe alternatives you've considered (描述你想到的折衷方案)**
   lalb在节点数较少时,多尝试几轮Select循环
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [I] lalb在有可用节点的情况下仍可能触发“[E112]Fail to select server...” (brpc)

Posted by "FancyJan (via GitHub)" <gi...@apache.org>.
FancyJan commented on issue #2427:
URL: https://github.com/apache/brpc/issues/2427#issuecomment-1781122070

   近期会提交一个pr


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org