Marcin Wanat
September 27, 2018 08:54AM
Hi,

i am using latest (1.15.4) nginx with stream module.

I am trying to create config with one primary server that will accept no
more than 10 connections and multiple backups that will also receive up to
10 connections only when previous backup server is already full.

As exact behavior of multiple backup directives is not well explained in
documentation i would like to ask if i am doing right.


My current configuration is:
stream {
upstream backend {
zone upstream_backend 64k;
server 10.0.1.1:9306 max_conns=10;
server 10.0.1.2:9306 max_conns=10 backup;
server 10.0.1.3:9306 max_conns=10 backup;
server 10.0.1.4:9306 backup;
}
server {
listen 127.0.0.1:9306;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass backend;
}
}


I would like it to work like this:

When we have up to 10 concurrent connections, all should go always to
primary 10.0.1.1

When we have 25 concurrent connections it should work like this:
-First 10 connections go to primary 10.0.1.1
-Next 10 connections go to backup 10.0.1.2
-Next 5 connections go to backup 10.0.1.3

When we have 45 concurrent connections it should work like this:
-First 10 connections go to primary 10.0.1.1
-Next 10 connections go to backup 10.0.1.2
-Next 10 connections go to backup 10.0.1.3
-Next 15 connections go to backup 10.0.1.4


Will multiple backup directives work as i expected or will they just round
robin between each of them up to max_conns limit ?


Regards,
Marcin Wanat
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Multiple upstream backup directives in stream module

Marcin Wanat September 27, 2018 08:54AM

Re: Multiple upstream backup directives in stream module

Roman Arutyunyan September 27, 2018 12:58PM

Re: Multiple upstream backup directives in stream module

Roman Arutyunyan September 28, 2018 11:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 229
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready