We have been using nginx as a reverse-proxy for a php farm, with "manual weight settings" for upstream hosts. The maybe 30 php backend servers are of wildly different power. We cannot change that.

We have reached the point where we cannot keep up with adjusting those weights manually any longer. Random spikes on individual upstream hosts will kill them before we can adjust weight. While other hosts are idle. (!)

What would be an alternative to manual weighted round-robin? Preferably an automatic solution based on the real upstream system load.


You can use the least-conn directive in your upstream module definitions. This specifies that a group should use a load balancing method where a request is passed to the server with the least number of active connections. It appeared in version 1.2.2.

More information is in the NGINX documentation: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#least_conn

| improve this answer | |
  • Interesting. Especially after seeing that it can supposedly also consider weights at the same time. (would be of no use if it bombards the weakest worker with an equal amount of connections) – user18099 Nov 6 '13 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.