<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">I’m experimenting with nginx module development by trying to implement a random load balancer.</div><div class=""><br class=""></div><div class="">I see that <font face="Menlo" class="">*us->servers->nelts</font> matches the upstream servers defined in nginx.conf</div><div class=""><br class=""></div><div class="">However, something that’s confusing to me is where <font face="Menlo" class="">*us->elts[0]->naddrs</font> comes from.</div><div class=""><br class=""></div><div class="">My thinking was that I could chose a random integer and select a peer by indexing it.</div><div class="">This doesn’t work reliably because the “real” webservers are only accessible every two indexes such as: <font face="Menlo" class="">&peer[0] => foo.example, &peer[3] => bar.example, and &peer[6] => baz.example</font>, etc.</div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class="">I’m having trouble finding why this is the case and any advice would be appreciated.</div><div class=""><br class=""></div><div class="">Thanks!</div><div class="">-Adam</div></body></html>