random load balancer
adam at anschwa.com
Sun Nov 5 01:56:29 UTC 2017
I’m experimenting with nginx module development by trying to implement a random load balancer.
I see that *us->servers->nelts matches the upstream servers defined in nginx.conf
However, something that’s confusing to me is where *us->elts->naddrs comes from.
My thinking was that I could chose a random integer and select a peer by indexing it.
This doesn’t work reliably because the “real” webservers are only accessible every two indexes such as: &peer => foo.example, &peer => bar.example, and &peer => baz.example, etc.
I’m having trouble finding why this is the case and any advice would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nginx