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

Hash load balancing does not work properly with this module #10

Open
truong-hua opened this issue Jun 7, 2022 · 4 comments
Open

Hash load balancing does not work properly with this module #10

truong-hua opened this issue Jun 7, 2022 · 4 comments

Comments

@truong-hua
Copy link

We are facing a weird problem that the upstream route request to different destination in different nodes.

We are running a 3 nginx nodes cluster with an upstream like this

upstream internal-hash-balancer {
	zone internal-hash-balancer 1m;
	dns_update 10s;
	dns_ipv6 off;
	hash $request_uri;
	
	server tasks.nginx:81 down;

	check fall=2 rise=2 interval=10 timeout=10000 type=tcp;
}

We have checked by added some header like add_header X-Hostname $hostname; and the load balancer may route the request to different target. We check the upstream status in healthcheck/status and seem like the order of the server list also matter. On the same order, it always route to the same destination but the nginx with a different order of server list in upstream will route the request to another destination which is not what a hash algorithm balancer should do.

I think this module should keep the server list in a certain order?

@truong-hua
Copy link
Author

@ZigzagAK can you help on this?

@ZigzagAK
Copy link
Owner

@truong-hua , Hi!
Hash method is unsupported. Only leastconn, roundrobin.

@truong-hua
Copy link
Author

@truong-hua , Hi! Hash method is unsupported. Only leastconn, roundrobin.

Hi @ZigzagAK do you know is it true that if we can keep the upstream in a consistent sorted order, this module will work well with hash load balancing? If so, I think I can try to optimize the module a little bit to support it. It would be great if you can help to review.

@truong-hua
Copy link
Author

@truong-hua , Hi! Hash method is unsupported. Only leastconn, roundrobin.

Hi @ZigzagAK do you know is it true that if we can keep the upstream in a consistent sorted order, this module will work well with hash load balancing? If so, I think I can try to optimize the module a little bit to support it. It would be great if you can help to review.

@ZigzagAK can you support me on this question so we can try to implement it? It would be great if this module can support the hash load balancing.

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