From 876cde0f2b7157bb5d11887e866b826d3b5da841 Mon Sep 17 00:00:00 2001 From: Kate Osborn Date: Wed, 3 May 2023 11:59:44 -0600 Subject: [PATCH 1/3] Set upstream zone size to 512k --- internal/nginx/config/upstreams_template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/nginx/config/upstreams_template.go b/internal/nginx/config/upstreams_template.go index 2755d58d6f..36a5a66c05 100644 --- a/internal/nginx/config/upstreams_template.go +++ b/internal/nginx/config/upstreams_template.go @@ -1,11 +1,11 @@ package config -// FIXME(kate-osborn): Add upstream zone size for each upstream. -// This should be dynamically calculated based on the number of upstreams. +// FIXME(kate-osborn): Dynamically calculate upstream zone size based on the number of upstreams. var upstreamsTemplateText = ` {{ range $u := . }} upstream {{ $u.Name }} { random two least_conn; + zone {{ $u.Name }} 512k; {{ range $server := $u.Servers }} server {{ $server.Address }}; {{- end }} From c8ac5a14971c5360eee5eecbbf4a9561355d859d Mon Sep 17 00:00:00 2001 From: Kate Osborn <50597707+kate-osborn@users.noreply.github.com> Date: Wed, 3 May 2023 12:12:49 -0600 Subject: [PATCH 2/3] Add comment about why 512k Co-authored-by: Michael Pleshakov --- internal/nginx/config/upstreams_template.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/nginx/config/upstreams_template.go b/internal/nginx/config/upstreams_template.go index 36a5a66c05..5b34576c35 100644 --- a/internal/nginx/config/upstreams_template.go +++ b/internal/nginx/config/upstreams_template.go @@ -1,6 +1,7 @@ package config // FIXME(kate-osborn): Dynamically calculate upstream zone size based on the number of upstreams. +// 512k will support up to 648 upstream servers. var upstreamsTemplateText = ` {{ range $u := . }} upstream {{ $u.Name }} { From 0ebad67d68bd972245550a2faec7c64e3b31acbc Mon Sep 17 00:00:00 2001 From: Kate Osborn Date: Wed, 3 May 2023 12:17:18 -0600 Subject: [PATCH 3/3] Appease linter --- internal/nginx/config/upstreams_template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/nginx/config/upstreams_template.go b/internal/nginx/config/upstreams_template.go index 5b34576c35..ce58f7fce5 100644 --- a/internal/nginx/config/upstreams_template.go +++ b/internal/nginx/config/upstreams_template.go @@ -1,7 +1,7 @@ package config // FIXME(kate-osborn): Dynamically calculate upstream zone size based on the number of upstreams. -// 512k will support up to 648 upstream servers. +// 512k will support up to 648 upstream servers. var upstreamsTemplateText = ` {{ range $u := . }} upstream {{ $u.Name }} {