Summary: | ASTERISK-14309: [patch] Patch to make DUNDi load balance across hosts with the same weight | ||
Reporter: | Liam Irish (irish) | Labels: | |
Date Opened: | 2009-06-12 17:32:58 | Date Closed: | 2011-06-07 14:00:59 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | PBX/pbx_dundi |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) dundi_shuffle.patch | |
Description: | Presently in 1.4.25 dundi lookups return the first existing member. If multiple members tie for the top rank, only the first host is called. By trivially changing the function passed to qsort, tied weights are shuffled within the tied partition. Overall ranking of weights is maintained. The result: when dundi lookup fetches the first member, it load balances across the top tier weight. I've uploaded the patch as a udiff in the information field. ****** ADDITIONAL INFORMATION ****** --- pbx_dundi.c.orig 2008-12-12 09:40:31.000000000 -0500 +++ pbx_dundi.c 2009-06-12 17:51:26.000000000 -0400 @@ -2371,7 +2371,7 @@ return -1; if (resa->weight > resb->weight) return 1; - return 0; + return ast_random() % 2 == 0 ? 1 : -1; /*shuffle res of same rank */ } static void sort_results(struct dundi_result *results, int count) | ||
Comments: | By: Ronald Chan (loloski) 2009-06-14 08:14:59 irish, while this is a great contribution to dundi, 1.4 branch is feature freeze, please attach a patch against trunk and let us hope someone from the developer will pick and evaluate your patch. By: Leif Madsen (lmadsen) 2009-07-27 14:45:34 License was rejected. Please reopen this issue and attach a new patch and refill in the license application, correcting any issues. Thanks! |