[dnsdist] leastOutstanding - With priority

Chris lists at shthead.net
Fri Jan 6 05:52:12 UTC 2017


On 5/01/2017 10:15 PM, Remi Gacogne wrote:
> You should be able to write a custom load-balancing policy in Lua quite
> easily, the Lua policy function gets the list of servers in the selected
> pool, and from the server object you can get its status (up or down),
> order and weight. You can easily select all the available servers of
> order 1 and pick one at random. If there is no such server available,
> pick one of order 10.

It looks like this is what I have to do.

I am new to Lua, so there is more than likely a more efficient way to do 
this than I have done but it looks like I have it working now.

If anyone else is interested in doing it I put the code on GitHub, feel 
free to use it as a template/example or hack away at it: 

If anyone has a look and has any comments on what could be done better I 
am happy to learn :)

More information about the dnsdist mailing list