Welcome! Log In Create A New Profile

Advanced

random load balancer

Posted by Adam Schwartz 
Adam Schwartz
random load balancer
November 05, 2017 03:00AM
Hello,

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[0]->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[0] => foo.example, &peer[3] => bar.example, and &peer[6] => baz.example, etc.

I’m having trouble finding why this is the case and any advice would be appreciated.

Thanks!
-Adam_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login