Start nginx with all servers weighted=0

Pablo Fischer pablo at pablo.com.mx
Wed Dec 19 19:47:04 UTC 2018


Hi all,

Sorry for posting to nginx-devel but looking to see if I'm missing any
details. I'm building a service discovery integration on top of our
Nginx, things work fine but there are two caveats:

- Nginx does not allow you to start with an empty upstream (aka no hosts).
- Nginx errors out with invalid configuration if you set a weight to "0".

I'm wondering if there is any technical reason of why I _should not_
make a patch that would allow the weight to be 0 during startup
configuration (or reload), looking specifically at this:

https://github.com/nginx/nginx/blob/cb4dd56771c1af082bf3e810436712b4f48f2cf2/src/http/ngx_http_upstream.c#L5839

or... if there is a known patch that does this already then even better.

We have a module that allows us set the weights dynamically via a URL
we have without reloading nginx (we can't execute continuous reloads
since our buffers are maxed out so this could potentially throw the
host into a OOM case).

Thanks!
-- 
Pablo


More information about the nginx-devel mailing list