Closed joshenders closed 7 years ago
not sure I get the question. There are two RR implementations, in the dns client (actually 2 here, RR for A/AAAA and WRR for SRV) and the RR implementation in the ring-balancer.
Ah, sorry if I wasn't clear. I'm referring to the RR balancer implementation. E.g, lib/resty/roundrobin.lua
. The documentation states that the chash and roundrobin modules have the same API but even after careful study it's not clear to me how one would use the roundrobin module since it appears very different from the chash module.
@joshenders I have just added a example in Synopsis.
By the way, the resty.chash
example Synopsis is a bit more complicated, because it's the example to keep the same hash result as the nginx builtin consistent_hash.
That's very helpful, thank you! I also ended up looking at the roundrobin test cases which made it more clear. Using _M.next()
was easier to reason about than _M.find()
.
Apologies for my remark above, had another repository in mind, so it is complete BS in relation to this repo. Sorry for the noise!
Would you be able to add an example of using the roundrobin load balancing algorithm in the synopsis?