Load balancing algorithm

Andrew Hutchings ahutchings at nginx.com
Mon Aug 1 09:19:59 UTC 2016


Hi Dewangga,

I'm not quite sure what your desired outcome would be by connecting to 
two servers at the same time for a single client but it won't work the 
way you might think it will.

I think what you might be looking for is the 'backup' keyword. With this 
NGINX will only fall back to that server if the primary servers are 
unavailable.

Using 'backup' is typically recommended for a Galera cluster anyway to 
avoid deadlocks at the commit sync due to the same table in multiple 
servers being written to at the same time. See this blog post for more 
information:

https://www.nginx.com/blog/advanced-mysql-load-balancing-with-nginx-plus/

Kind Regards
Andrew

On 01/08/16 09:20, Dewangga Bachrul Alam wrote:
> Hello!
>
> I got curios with load balancing algorithm, I got scenarios like this.
>
> I have 3 galera cluster, each cluster have 3 node and it was solved with
> stream module.
>
> Cluster1:
> Node1-Cluster1: 192.168.11.1
> Node2-Cluster1: 192.168.11.2
> Node3-Cluster1: 192.168.11.3
>
> Cluster2:
> Node1-Cluster2: 192.168.12.1
> Node2-Cluster2: 192.168.12.2
> Node3-Cluster2: 192.168.12.3
>
> Cluster3:
> Node1-Cluster3: 192.168.13.1
> Node2-Cluster3: 192.168.13.2
> Node3-Cluster3: 192.168.13.3
>
> Cluster4:
> Node1-Cluster1: 192.168.11.1
> Node1-Cluster4: 192.168.14.1
>
> But, I want to build another cluster and wont sync with galera cluster.
> Is there any alternative instead of roundrobind, least_connected and
> ip_hash?
>
> I want the algorithm is connect to backend at the sametime, looks like:
>
> upstream Cluster4{
> 	server 192.168.11.1:3306 max_fails=0;
> 	server 192.168.14.1:3306 max_fails=0;
> }
>
> Since it's not synced, the query to upstream "Cluster4" should be not
> round robin or asynchronous to backend, it should be simultaneously.
>
> Is it possible? If yes, which method should be picked up?
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>

-- 
Andrew Hutchings (LinuxJedi)
Technical Product Manager, NGINX Inc.



More information about the nginx mailing list