Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx Ingress Controller - Specify load balancing method #656

Closed
silasbw opened this issue Apr 26, 2017 · 3 comments
Closed

Nginx Ingress Controller - Specify load balancing method #656

silasbw opened this issue Apr 26, 2017 · 3 comments

Comments

@silasbw
Copy link

silasbw commented Apr 26, 2017

The nginx ingress controller hard codes least_conn as the load balancing method.

It would be helpful to specify the load balancing method per ingress resource. For example, via an annotation on the ingress resource.

Not all workloads perform well under least_conn, and the nginx documentation recommends experimenting with different load balancing methods. The ability to specify the method per ingress resource would facilitate this experimentation.

@silasbw
Copy link
Author

silasbw commented Apr 27, 2017

Related: is least_conn a good default in general?

Consider the case of multiple nginx controller pods (e.g., using a Deployment of DaemonSet). Assuming each Pod has the same nginx config (i.e., the upstream servers are listed in the same order), least_conn might have poor load balancing since each nginx controller Pod will route it's first connection to the first upstream server in the list. The second connections will all go to the second upstream server in the list, etc.

I think our current cluster setup is bumping up against this imbalance behavior.

A few half-baked proposals to get better load balancing:

  • change the default load balancing method to round-robin; or
  • randomize the lists of upstream servers in the nginx config; or
  • ...

@silasbw
Copy link
Author

silasbw commented Apr 27, 2017

Chatted with @aledbf. He points out:

  • A good option for changing load balancing behavior globally is via nginx ConfigMap customization.
  • Randomizing upstream servers can be problematic with scale ups/downs. Also Nordstrom/kubernetes-contrib@53c6509.
  • Adding load balancing methods per Ingress resource is the most complicated and there's some concerns around making it portable between ingress controllers.

@aledbf
Copy link
Member

aledbf commented May 1, 2017

fixes in #673

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants