From 868e1db469bb6a5755452fe31f8e2e25e86d7d5e Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Wed, 18 Sep 2024 14:35:39 +0100 Subject: Make nginx load balance using least-connections By default, nginx uses round robin for load balancing. Round robin works well when all requests take same amount of time, but is not optimal for dynamic loads. With least-connected load balancing, nginx will try not to overload a busy server with excessive requests, sending requests to a less busy server instead. Issue-ID: CPS-2415 Signed-off-by: danielhanrahan Change-Id: I0e7d6b36a79aa6541f2f5f667746f2792d55e54b --- docker-compose/config/nginx/nginx.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docker-compose/config') diff --git a/docker-compose/config/nginx/nginx.conf b/docker-compose/config/nginx/nginx.conf index 17fad1b876..61fed515c3 100644 --- a/docker-compose/config/nginx/nginx.conf +++ b/docker-compose/config/nginx/nginx.conf @@ -20,7 +20,9 @@ http { # Add more server entries here for scaling or load balancing upstream cps-and-ncmp { - server cps-and-ncmp:8080; + least_conn; + server docker-compose-cps-and-ncmp-1:8080; + server docker-compose-cps-and-ncmp-2:8080; } server { -- cgit 1.2.3-korg